@@ -75,7 +75,6 @@ def create(
7575 description : Text ,
7676 instructions : Optional [Text ] = None ,
7777 llm : Optional [Union [LLM , Text ]] = None ,
78- llm_id : Optional [Text ] = None ,
7978 tools : Optional [List [Union [Tool , Model ]]] = None ,
8079 api_key : Text = config .TEAM_API_KEY ,
8180 supplier : Union [Dict , Text , Supplier , int ] = "aiXplain" ,
@@ -84,6 +83,7 @@ def create(
8483 workflow_tasks : Optional [List [WorkflowTask ]] = None ,
8584 output_format : Optional [OutputFormat ] = None ,
8685 expected_output : Optional [Union [BaseModel , Text , dict ]] = None ,
86+ ** kwargs ,
8787 ) -> Agent :
8888 """Create a new agent in the platform.
8989
@@ -97,7 +97,6 @@ def create(
9797 description (Text): description of the agent instructions.
9898 instructions (Text): instructions of the agent.
9999 llm (Optional[Union[LLM, Text]], optional): LLM instance to use as an object or as an ID.
100- llm_id (Optional[Text], optional): ID of LLM to use if no LLM instance provided. Defaults to None.
101100 tools (List[Union[Tool, Model]], optional): list of tool for the agent. Defaults to [].
102101 api_key (Text, optional): team/user API key. Defaults to config.TEAM_API_KEY.
103102 supplier (Union[Dict, Text, Supplier, int], optional): owner of the agent. Defaults to "aiXplain".
@@ -106,14 +105,24 @@ def create(
106105 workflow_tasks (List[WorkflowTask], optional): list of tasks for the agent. Defaults to [].
107106 output_format (OutputFormat, optional): default output format for agent responses. Defaults to OutputFormat.TEXT.
108107 expected_output (Union[BaseModel, Text, dict], optional): expected output. Defaults to None.
109-
108+ **kwargs: Additional keyword arguments.
110109 Returns:
111110 Agent: created Agent
112111 """
113112 tools = [] if tools is None else list (tools )
114113 workflow_tasks = [] if workflow_tasks is None else list (workflow_tasks )
115114 from aixplain .utils .llm_utils import get_llm_instance
116115
116+ # Extract llm_id from kwargs if present (deprecated parameter)
117+ llm_id = kwargs .get ("llm_id" , None )
118+ if llm_id is not None :
119+ warnings .warn (
120+ "The 'llm_id' parameter is deprecated and will be removed in a future version. "
121+ "Use the 'llm' parameter instead by passing the LLM ID or LLM instance directly." ,
122+ DeprecationWarning ,
123+ stacklevel = 2 ,
124+ )
125+
117126 if llm is None and llm_id is not None :
118127 llm = get_llm_instance (llm_id , api_key = api_key , use_cache = True )
119128 elif llm is None :
@@ -126,9 +135,7 @@ def create(
126135 ), "'expected_output' must be a Pydantic BaseModel or a JSON object when 'output_format' is JSON."
127136
128137 warnings .warn (
129- "Use `llm` to define the large language model (aixplain.modules.model.llm_model.LLM) to be used as agent. "
130- "Use `llm_id` to provide the model ID of the large language model to be used as agent. "
131- "Note: In upcoming releases, `llm` will become a required parameter." ,
138+ "Deprecating 'llm_id', use `llm` to define the large language model in agents." ,
132139 UserWarning ,
133140 )
134141 from aixplain .factories .agent_factory .utils import (
@@ -159,8 +166,8 @@ def create(
159166 payload = {
160167 "name" : name ,
161168 "assets" : [build_tool_payload (tool ) for tool in tools ],
162- "description" : to_literal_text ( description ) ,
163- "instructions" : to_literal_text ( instructions ) if instructions is not None else description ,
169+ "description" : description ,
170+ "instructions" : instructions if instructions is not None else description ,
164171 "supplier" : supplier ,
165172 "version" : version ,
166173 "llmId" : llm_id ,
0 commit comments