Skip to content

Commit

Permalink
Add dynamic tool call data model selection for agents
Browse files Browse the repository at this point in the history
  • Loading branch information
AndersonBY committed Sep 23, 2024
1 parent b8b3eaa commit 4a33ef6
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
7 changes: 6 additions & 1 deletion backend/utilities/ai_utils/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ def __init__(self, workflow: Workflow | WorkflowTemplate):
self.parameter_sources = self.tool_call_data.get("parameter_sources", {})
user_settings = Settings()
vectorvein_settings.load(user_settings.get("llm_settings"))
self.chat_client = create_chat_client(backend=BackendType.OpenAI, model="gpt-4o-mini", stream=False)
backend, model = user_settings.get("agent.tool_call_data_generate_model")
if backend.lower().startswith("_local__"):
backend = BackendType.Local
else:
backend = BackendType(backend.lower())
self.chat_client = create_chat_client(backend=backend, model=model, stream=False)

@staticmethod
def _is_valid_string(s):
Expand Down
7 changes: 6 additions & 1 deletion backend/utilities/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@
"stability_key": "",
"use_system_proxy": True,
"website_domain": "vectorvein.ai",
"agent": {"auto_title": True, "auto_title_model": ["OpenAI", "gpt-4o-mini"], "screenshot_monitor_device": 0},
"agent": {
"auto_title": True,
"auto_title_model": ["OpenAI", "gpt-4o-mini"],
"screenshot_monitor_device": 0,
"tool_call_data_generate_model": ["OpenAI", "gpt-4o-mini"],
},
"microphone_device": 0,
"shortcuts": {},
"embedding_models": {"text_embeddings_inference": {"api_base": "http://localhost:8080/embed"}},
Expand Down
1 change: 1 addition & 0 deletions frontend/src/locales/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -1890,6 +1890,7 @@ export default {
'select_all': 'Select all',
'clear': 'Clear',
'list_models_failed': 'Failed to get model list',
'agent_tool_call_data_generate_model': 'Agent tool call data generation model',
},
voiceOptions: {
"minimax_male-qn-qingse": "Youthful Male Voice",
Expand Down
1 change: 1 addition & 0 deletions frontend/src/locales/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -1890,6 +1890,7 @@ export default {
'select_all': '全选',
'clear': '清除',
'list_models_failed': '获取模型列表失败',
'agent_tool_call_data_generate_model': 'Agent 工具调用数据生成模型',
},
voiceOptions: {
"minimax_male-qn-qingse": "青涩青年音色",
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,10 @@ watch(selectedKeys, () => {
</template>
<a-input-number v-model:value="settingForm.data.agent.screenshot_monitor_device" />
</a-form-item>
<a-form-item :label="t('settings.agent_tool_call_data_generate_model')">
<a-cascader style="width: 100%;" v-model:value="settingForm.data.agent.tool_call_data_generate_model"
:options="chatModelOptions" />
</a-form-item>
</a-form>
</a-card>
</a-layout-content>
Expand Down

0 comments on commit 4a33ef6

Please sign in to comment.