Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
added logging of raw response on debug (#666)
Charles Packera283d97d171d
diff --git a/memgpt/openai_tools.py b/memgpt/openai_tools.pyindex 1744d2cb8..225d4f5dc 100644--- a/memgpt/openai_tools.py+++ b/memgpt/openai_tools.py@@ -100,9 +100,10 @@ def openai_chat_completions_request(url, api_key, data):# data["messages"][-1]["content"] = " ".join(["repeat after me this is not a fluke"] * 1000)response = requests.post(url, headers=headers, json=data)+ printd(f"response = {response}")response.raise_for_status() # Raises HTTPError for 4XX/5XX statusresponse = response.json() # convert to dict from string- printd(f"response = {response}")+ printd(f"response.json = {response}")response = Box(response) # convert to 'dot-dict' style which is the openai python client defaultreturn responseexcept requests.exceptions.HTTPError as http_err:@@ -129,9 +130,10 @@ def openai_embeddings_request(url, api_key, data):printd(f"Sending request to {url}")try:response = requests.post(url, headers=headers, json=data)+ printd(f"response = {response}")response.raise_for_status() # Raises HTTPError for 4XX/5XX statusresponse = response.json() # convert to dict from string- printd(f"response = {response}")+ printd(f"response.json = {response}")response = Box(response) # convert to 'dot-dict' style which is the openai python client defaultreturn responseexcept requests.exceptions.HTTPError as http_err:@@ -164,9 +166,10 @@ def azure_openai_chat_completions_request(resource_name, deployment_id, api_versprintd(f"Sending request to {url}")try:response = requests.post(url, headers=headers, json=data)+ printd(f"response = {response}")response.raise_for_status() # Raises HTTPError for 4XX/5XX statusresponse = response.json() # convert to dict from string- printd(f"response = {response}")+ printd(f"response.json = {response}")# NOTE: azure openai does not include "content" in the response when it is None, so we need to add itif "content" not in response["choices"][0].get("message"):response["choices"][0]["message"]["content"] = None@@ -197,9 +200,10 @@ def azure_openai_embeddings_request(resource_name, deployment_id, api_version, aprintd(f"Sending request to {url}")try:response = requests.post(url, headers=headers, json=data)+ printd(f"response = {response}")response.raise_for_status() # Raises HTTPError for 4XX/5XX statusresponse = response.json() # convert to dict from string- printd(f"response = {response}")+ printd(f"response.json = {response}")response = Box(response) # convert to 'dot-dict' style which is the openai python client defaultreturn responseexcept requests.exceptions.HTTPError as http_err: