You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromtypingimportAny, Dictfromyour_client_libraryimportClient# Replace with actual importtool_schema= {
"name": "record_travel_request_attributes",
"description": "Records the attributes of a travel request",
"input_schema": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": 'The desired destination location. Use city, state, and country format when possible. If no destination is provided, return "not_stated".',
},
"budget_level": {
"type": "string",
"enum": ["low", "medium", "high", "not_stated"],
"description": 'The desired budget level. If no budget level is provided, return "not_stated".',
},
"purpose": {
"type": "string",
"enum": ["business", "pleasure", "other", "not_stated"],
"description": 'The purpose of the trip. If no purpose is provided, return "not_stated".',
},
},
"required": ["location", "budget_level", "purpose"],
},
}
system_message= (
"You are an assistant that parses and records the attributes of a user's travel request."
)
defextract_raw_travel_request_attributes_string(
travel_request: str,
client: Client,
model: str="claude-3-5-sonnet-20240620",
) ->str:
response=client.messages.create(
model=model,
max_tokens=1024,
messages=[
{"role": "user", "content": travel_request},
],
system=system_message,
tools=[tool_schema],
tool_choice={"type": "tool", "name": "record_travel_request_attributes"},
)
# Process the response to extract the relevant information# This is a placeholder - you'll need to implement the actual extraction logicextracted_attributes=process_response(response)
returnextracted_attributesdefprocess_response(response: Any) ->str:
# Implement the logic to extract the attributes from the response# This is a placeholder functionpass```
The text was updated successfully, but these errors were encountered:
see example:
The text was updated successfully, but these errors were encountered: