mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-29 08:33:20 +00:00
fix: model in agents via api (#2174)
This commit is contained in:
@@ -103,11 +103,10 @@ class StreamProcessor:
|
|||||||
|
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
"""Initialize all required components for processing"""
|
"""Initialize all required components for processing"""
|
||||||
self._validate_and_set_model()
|
|
||||||
self._configure_agent()
|
self._configure_agent()
|
||||||
|
self._validate_and_set_model()
|
||||||
self._configure_source()
|
self._configure_source()
|
||||||
self._configure_retriever()
|
self._configure_retriever()
|
||||||
self._configure_agent()
|
|
||||||
self._load_conversation_history()
|
self._load_conversation_history()
|
||||||
self._process_attachments()
|
self._process_attachments()
|
||||||
|
|
||||||
@@ -229,6 +228,11 @@ class StreamProcessor:
|
|||||||
+ (f" and {len(available_models) - 5} more" if len(available_models) > 5 else "")
|
+ (f" and {len(available_models) - 5} more" if len(available_models) > 5 else "")
|
||||||
)
|
)
|
||||||
self.model_id = requested_model
|
self.model_id = requested_model
|
||||||
|
else:
|
||||||
|
# Check if agent has a default model configured
|
||||||
|
agent_default_model = self.agent_config.get("default_model_id", "")
|
||||||
|
if agent_default_model and validate_model_id(agent_default_model):
|
||||||
|
self.model_id = agent_default_model
|
||||||
else:
|
else:
|
||||||
self.model_id = get_default_model_id()
|
self.model_id = get_default_model_id()
|
||||||
|
|
||||||
@@ -303,6 +307,10 @@ class StreamProcessor:
|
|||||||
data["sources"] = sources_list
|
data["sources"] = sources_list
|
||||||
else:
|
else:
|
||||||
data["sources"] = []
|
data["sources"] = []
|
||||||
|
|
||||||
|
# Preserve model configuration from agent
|
||||||
|
data["default_model_id"] = data.get("default_model_id", "")
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def _configure_source(self):
|
def _configure_source(self):
|
||||||
@@ -355,6 +363,7 @@ class StreamProcessor:
|
|||||||
"agent_type": data_key.get("agent_type", settings.AGENT_NAME),
|
"agent_type": data_key.get("agent_type", settings.AGENT_NAME),
|
||||||
"user_api_key": api_key,
|
"user_api_key": api_key,
|
||||||
"json_schema": data_key.get("json_schema"),
|
"json_schema": data_key.get("json_schema"),
|
||||||
|
"default_model_id": data_key.get("default_model_id", ""),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
self.initial_user_id = data_key.get("user")
|
self.initial_user_id = data_key.get("user")
|
||||||
@@ -379,6 +388,7 @@ class StreamProcessor:
|
|||||||
"agent_type": data_key.get("agent_type", settings.AGENT_NAME),
|
"agent_type": data_key.get("agent_type", settings.AGENT_NAME),
|
||||||
"user_api_key": self.agent_key,
|
"user_api_key": self.agent_key,
|
||||||
"json_schema": data_key.get("json_schema"),
|
"json_schema": data_key.get("json_schema"),
|
||||||
|
"default_model_id": data_key.get("default_model_id", ""),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
self.decoded_token = (
|
self.decoded_token = (
|
||||||
@@ -405,6 +415,7 @@ class StreamProcessor:
|
|||||||
"agent_type": settings.AGENT_NAME,
|
"agent_type": settings.AGENT_NAME,
|
||||||
"user_api_key": None,
|
"user_api_key": None,
|
||||||
"json_schema": None,
|
"json_schema": None,
|
||||||
|
"default_model_id": "",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ OPENAI_MODELS = [
|
|||||||
supports_tools=True,
|
supports_tools=True,
|
||||||
supports_structured_output=True,
|
supports_structured_output=True,
|
||||||
supported_attachment_types=OPENAI_ATTACHMENTS,
|
supported_attachment_types=OPENAI_ATTACHMENTS,
|
||||||
context_window=400000,
|
context_window=200000,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
AvailableModel(
|
AvailableModel(
|
||||||
@@ -49,7 +49,7 @@ OPENAI_MODELS = [
|
|||||||
supports_tools=True,
|
supports_tools=True,
|
||||||
supports_structured_output=True,
|
supports_structured_output=True,
|
||||||
supported_attachment_types=OPENAI_ATTACHMENTS,
|
supported_attachment_types=OPENAI_ATTACHMENTS,
|
||||||
context_window=400000,
|
context_window=200000,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
@@ -133,7 +133,7 @@ GOOGLE_MODELS = [
|
|||||||
supports_tools=True,
|
supports_tools=True,
|
||||||
supports_structured_output=True,
|
supports_structured_output=True,
|
||||||
supported_attachment_types=GOOGLE_ATTACHMENTS,
|
supported_attachment_types=GOOGLE_ATTACHMENTS,
|
||||||
context_window=20000, # Set low for testing compression
|
context_window=2000000,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user