Skip to content

Commit 1700304

Browse files
ENG-504: Make the agent architecture configurable (#243)
* Make the agent architecture configurable * Remove One tool requirement in Agent Creation
1 parent f3d89ed commit 1700304

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

aixplain/factories/agent_factory/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class AgentFactory:
4444
def create(
4545
cls,
4646
name: Text,
47-
llm_id: Text,
47+
llm_id: Text = "669a63646eb56306647e1091",
4848
tools: List[Tool] = [],
4949
description: Text = "",
5050
api_key: Text = config.TEAM_API_KEY,
@@ -56,7 +56,7 @@ def create(
5656
5757
Args:
5858
name (Text): name of the agent
59-
llm_id (Text): aiXplain ID of the large language model to be used as agent.
59+
llm_id (Text, optional): aiXplain ID of the large language model to be used as agent. Defaults to "669a63646eb56306647e1091" (GPT-4o mini).
6060
tools (List[Tool], optional): list of tool for the agent. Defaults to [].
6161
description (Text, optional): description of the agent role. Defaults to "".
6262
api_key (Text, optional): team/user API key. Defaults to config.TEAM_API_KEY.

tests/functional/agent/agent_functional_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
load_dotenv()
2222
from aixplain.factories import AgentFactory
23+
from aixplain.enums.function import Function
2324
from aixplain.enums.supplier import Supplier
2425

2526
import pytest
@@ -79,5 +80,7 @@ def test_list_agents():
7980

8081
def test_fail_non_existent_llm():
8182
with pytest.raises(Exception) as exc_info:
82-
AgentFactory.create(name="Test Agent", llm_id="non_existent_llm", tools=[])
83+
AgentFactory.create(
84+
name="Test Agent", llm_id="non_existent_llm", tools=[AgentFactory.create_model_tool(function=Function.TRANSLATION)]
85+
)
8386
assert str(exc_info.value) == "Large Language Model with ID 'non_existent_llm' not found."

tests/unit/agent_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ def test_sucess_query_content():
6969
def test_invalid_pipelinetool():
7070
with pytest.raises(Exception) as exc_info:
7171
AgentFactory.create(
72-
name="Test", tools=[PipelineTool(pipeline="309851793", description="Test")], llm_id="6646261c6eb563165658bbb1"
72+
name="Test",
73+
description="Test Description",
74+
tools=[PipelineTool(pipeline="309851793", description="Test")],
75+
llm_id="6646261c6eb563165658bbb1",
7376
)
7477
assert str(exc_info.value) == "Pipeline Tool Unavailable. Make sure Pipeline '309851793' exists or you have access to it."
7578

0 commit comments

Comments
 (0)