-
Notifications
You must be signed in to change notification settings - Fork 97
Open
Description
Multiple places where client_tools are needed
- User implements a client tool
### [1] Define the tool
@client_tool
def get_ticker_data(ticker_symbol: str, start: str, end: str) -> str:
"""
Get yearly closing prices for a given ticker symbol
:param ticker_symbol: The ticker symbol for which to get the data. eg. '^GSPC'
:param start: Start date, eg. '2021-01-01'
:param end: End date, eg. '2024-12-31'
:return: JSON string of yearly closing prices
"""
...
return some_json[2] Provide tool def in the config
agent_config = AgentConfig(
model=selected_model,
instructions="You are a helpful assistant",
sampling_params={
"strategy": {"type": "top_p", "temperature": 1.0, "top_p": 0.9},
},
toolgroups=["builtin::rag"],
# --> we need to mention tool defs here <-- #
client_tools=[
client_tool.get_tool_definition() for client_tool in client_tools
],
tool_config: ...,
input_shields=available_shields if available_shields else [],
output_shields=available_shields if available_shields else [],
enable_session_persistence=False,
)[3] again pass client tools here
agent = Agent(client, agent_config, client_tools)Step [2] should not be necessary and we should just take client tools provided in [3] and inject them into the config before sending to server.
Proposal
@client_tool
def get_ticker_data(ticker_symbol: str, start: str, end: str) -> str:
"""
Get yearly closing prices for a given ticker symbol
:param ticker_symbol: The ticker symbol for which to get the data. eg. '^GSPC'
:param start: Start date, eg. '2021-01-01'
:param end: End date, eg. '2024-12-31'
:return: JSON string of yearly closing prices
"""
...
return some_json
# simplify by taking all tools in one place
tools = [
# can be a simple str
"builltin::websearch",
# can be a dict that takes additional params for builtin tools
{
"name": "builtin::rag",
"args": {
"vector_db_ids": [vector_db_id],
},
},
# can be a client tool
get_ticker_data,
]
# no tool info in agent-config
agent_config = AgentConfig(
model=selected_model,
instructions="You are a helpful assistant, keep answers short and concise",
sampling_params={
"strategy": {"type": "top_p", "temperature": 1.0, "top_p": 0.9},
},
tool_config: {
"system_message_behavior": "append",
},
input_shields=[],
output_shields=[],
enable_session_persistence=True,
)
# we will take tools and extract tool defs and pass them to the server appropriately
agent = Agent(client, agent_config, tools) Metadata
Metadata
Assignees
Labels
No labels