Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
feat(JSON Response): Enable JSON Response format for all Openai Calls… (#1401)
lenaxiaf370670db1ab
diff --git a/memgpt/llm_api/llm_api_tools.py b/memgpt/llm_api/llm_api_tools.pyindex 59abc09e1..fcea4ce24 100644--- a/memgpt/llm_api/llm_api_tools.py+++ b/memgpt/llm_api/llm_api_tools.py@@ -159,6 +159,7 @@ def create(printd(f"Using model {llm_config.model_endpoint_type}, endpoint: {llm_config.model_endpoint}")# TODO eventually refactor so that credentials are passed through+credentials = MemGPTCredentials.load()if function_call and not functions:@@ -178,6 +179,7 @@ def create(tools=[{"type": "function", "function": f} for f in functions] if functions else None,tool_choice=function_call,user=str(user_id),+ response_format={"type": "json_object"},)else:data = ChatCompletionRequest(@@ -186,6 +188,7 @@ def create(functions=functions,function_call=function_call,user=str(user_id),+ response_format={"type": "json_object"},)if stream:diff --git a/memgpt/utils.py b/memgpt/utils.pyindex c7d842322..2b7632954 100644--- a/memgpt/utils.py+++ b/memgpt/utils.py@@ -36,9 +36,11 @@ from memgpt.constants import (from memgpt.models.chat_completion_response import ChatCompletionResponsefrom memgpt.openai_backcompat.openai_object import OpenAIObject-# TODO: what is this?-# DEBUG = TrueDEBUG = False+if "LOG_LEVEL" in os.environ:+ if os.environ["LOG_LEVEL"] == "DEBUG":+ DEBUG = True+ADJECTIVE_BANK = ["beautiful",