mirror of
https://github.com/katanemo/plano.git
synced 2026-04-26 01:06:25 +02:00
* adding function_calling functionality via rust * fixed rendered YAML file * removed model_server from envoy.template and forwarding traffic to bright_staff * fixed bugs in function_calling.rs that were breaking tests. All good now * updating e2e test to clean up disk usage * removing Arch* models to be used as a default model if one is not specified * if the user sets arch-function base_url we should honor it * fixing demos as we needed to pin to a particular version of huggingface_hub else the chatbot ui wouldn't build * adding a constant for Arch-Function model name * fixing some edge cases with calls made to Arch-Function * fixed JSON parsing issues in function_calling.rs * fixed bug where the raw response from Arch-Function was re-encoded * removed debug from supervisord.conf * commenting out disk cleanup * adding back disk space --------- Co-authored-by: Salman Paracha <salmanparacha@MacBook-Pro-288.local> Co-authored-by: Salman Paracha <salmanparacha@MacBook-Pro-342.local>
369 lines
11 KiB
ReStructuredText
369 lines
11 KiB
ReStructuredText
@model_server_endpoint = http://localhost:12000
|
|
@archfc_endpoint = https://archfc.katanemo.dev
|
|
|
|
### multi turn conversation with intent, except parameter gathering
|
|
|
|
POST {{model_server_endpoint}}/function_calling HTTP/1.1
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"messages": [
|
|
{
|
|
"role": "user",
|
|
"content": "how is the weather for next 5 days?"
|
|
},
|
|
{
|
|
"role": "assistant",
|
|
"content": "Can you tell me your location and how many days you want?"
|
|
},
|
|
{
|
|
"role": "user",
|
|
"content": "Seattle"
|
|
},
|
|
{
|
|
"role": "assistant",
|
|
"content": "Can you please provide me the days for the weather forecast?"
|
|
},
|
|
{
|
|
"role": "user",
|
|
"content": "Sorry, the location is actually los angeles in 5 days"
|
|
}
|
|
],
|
|
"tools": [
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "get_current_weather",
|
|
"description": "Get current weather at a location.",
|
|
"parameters": {
|
|
"type": "object",
|
|
"properties": {
|
|
"location": {
|
|
"type": "str",
|
|
"description": "The location to get the weather for",
|
|
"format": "City, State"
|
|
},
|
|
"days": {
|
|
"type": "str",
|
|
"description": "the number of days for the request."
|
|
}
|
|
},
|
|
"required": ["location", "days"]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
|
|
### multi turn conversation with intent, except parameter gathering
|
|
POST {{model_server_endpoint}}/function_calling HTTP/1.1
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"messages": [
|
|
{
|
|
"role": "user",
|
|
"content": "hi"
|
|
},
|
|
{
|
|
"role": "assistant",
|
|
"content": "Can you tell me your location and how many days you want?"
|
|
},
|
|
{
|
|
"role": "user",
|
|
"content": "Seattle"
|
|
},
|
|
{
|
|
"role": "assistant",
|
|
"content": "Can you please provide me the days for the weather forecast?"
|
|
},
|
|
{
|
|
"role": "user",
|
|
"content": "Sorry, the location is actually los angeles in 5 days"
|
|
}
|
|
],
|
|
"tools": [
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "get_current_weather",
|
|
"description": "Get current weather at a location.",
|
|
"parameters": {
|
|
"type": "object",
|
|
"properties": {
|
|
"location": {
|
|
"type": "str",
|
|
"description": "The location to get the weather for",
|
|
"format": "City, State"
|
|
},
|
|
"days": {
|
|
"type": "str",
|
|
"description": "the number of days for the request."
|
|
}
|
|
},
|
|
"required": ["location", "days"]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
|
|
### multi turn conversation with correct parameters
|
|
POST {{model_server_endpoint}}/function_calling HTTP/1.1
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"messages": [
|
|
{
|
|
"role": "user",
|
|
"content": "Give me a product recommendation"
|
|
},
|
|
{
|
|
"role": "user",
|
|
"content": "Sure, I can help with that. Could you please specify the category you're interested in, such as electronics, clothing, or books?"
|
|
},
|
|
{
|
|
"role": "user",
|
|
"content": "i would like phones"
|
|
},
|
|
{
|
|
"role": "user",
|
|
"content": "May I have your unique identifier and the maximum number of recommendations you want to receive?"
|
|
},
|
|
{
|
|
"role": "user",
|
|
"content": "user id is 1234 and 5 recommendations please"
|
|
}
|
|
],
|
|
"tools": [
|
|
{
|
|
"type": "function",
|
|
"function":
|
|
{
|
|
"name": "product_recommendation",
|
|
"description": "Provide personalized product recommendations for users based on their preferences and purchase history.",
|
|
"parameters": {
|
|
"type": "object",
|
|
"properties": {
|
|
"user_id": {
|
|
"type": "str",
|
|
"description": "Unique identifier for the user."
|
|
},
|
|
"category": {
|
|
"type": "str",
|
|
"description": "Product category for recommendations."
|
|
},
|
|
"max_results": {
|
|
"type": "int",
|
|
"description": "Maximum number of recommended products to retrieve.",
|
|
"default": 10
|
|
}
|
|
},
|
|
"required": ["user_id", "category"]
|
|
}
|
|
}
|
|
|
|
}
|
|
]
|
|
}
|
|
### multi turn enums
|
|
POST {{model_server_endpoint}}/function_calling HTTP/1.1
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"messages": [
|
|
{
|
|
"role": "user",
|
|
"content": "Give me a product recommendation"
|
|
},
|
|
{
|
|
"role": "assistant",
|
|
"content": "Can you please specify the category of products you are interested in?"
|
|
},
|
|
{
|
|
"role": "user",
|
|
"content": "Phones"
|
|
}
|
|
],
|
|
"tools": [
|
|
{
|
|
"id": "recommendation-112",
|
|
"type": "function",
|
|
"function":
|
|
{
|
|
"name": "product_recommendation",
|
|
"description": "Provides product recommendations",
|
|
"parameters": {
|
|
"type": "object",
|
|
"properties": {
|
|
"category": {
|
|
"type": "str",
|
|
"description": "Product category for recommendations",
|
|
"enum": ["electronics", "clothing", "books", "phones"]
|
|
},
|
|
"max_results": {
|
|
"type": "int",
|
|
"description": "Maximum number of recommended products to retrieve.",
|
|
"default": 10
|
|
}
|
|
},
|
|
"required": ["category"]
|
|
}
|
|
}
|
|
|
|
}
|
|
]
|
|
}
|
|
### multiturn enum with correcting parameters
|
|
|
|
POST {{model_server_endpoint}}/function_calling HTTP/1.1
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"messages": [
|
|
{
|
|
"role": "user",
|
|
"content": " Can you show the workforce data for agency staff in 3 days"
|
|
},
|
|
{
|
|
"role": "assistant",
|
|
"content": "Of course, I can help with that. However, I need the region and staffing type to provide the workforce data. Could you please provide that information?"
|
|
},
|
|
{
|
|
"role": "user",
|
|
"content": "americaz"
|
|
}
|
|
],
|
|
"tools": [
|
|
{
|
|
"id": "hr-112",
|
|
"type": "function",
|
|
"function":
|
|
{
|
|
"name": "get_hr_data",
|
|
"description": "Get workforce data like headcount and satisfacton levels by region and staffing type.",
|
|
"parameters": {
|
|
"type": "object",
|
|
"properties": {
|
|
"staffing_type": {
|
|
"type": "str",
|
|
"description": "Staffing type of employees"
|
|
},
|
|
"region": {
|
|
"type": "str",
|
|
"description": "Geographical region for which you want workforce data.",
|
|
"enum": ["americas", "emea", "apac"]
|
|
},
|
|
"point_in_time": {
|
|
"type": "str",
|
|
"description": "the point in time for which to retrieve data.",
|
|
"default": "1"
|
|
}
|
|
},
|
|
"required": ["staffing_type", "region"]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
|
|
### single turn parameter gathering
|
|
|
|
POST {{model_server_endpoint}}/function_calling HTTP/1.1
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"messages": [
|
|
{
|
|
"role": "user",
|
|
"content": "i want to start a car insurance policy with 500 deductible"
|
|
}
|
|
],
|
|
"tools": [
|
|
{"type": "function",
|
|
"function": {"name": "policy_qa",
|
|
"description": "Handle general Q/A related to insurance.",
|
|
"parameters": {"type": "object", "properties": {}, "required": []}}},
|
|
|
|
{"type": "function",
|
|
"function": {"name": "get_policy_coverage",
|
|
"description": "Retrieve the coverage details for an insurance policy .",
|
|
"parameters": {"type": "object",
|
|
"properties": {"policy_type": {"type": "str",
|
|
"description": "The type of insurance policy."}},
|
|
"required": ["policy_type"]}}},
|
|
|
|
{"type": "function",
|
|
"function": {"name": "initiate_policy",
|
|
"description": "Start a policy coverage for an insurance policy.",
|
|
"parameters": {"type": "object",
|
|
"properties": {"policy_type": {"type": "str",
|
|
"description": "The type of insurance policy."},
|
|
"deductible": {"type": "float",
|
|
"description": "The deductible amount set for the policy."}},
|
|
"required": ["policy_type", "deductible"]}}},
|
|
|
|
{"type": "function",
|
|
"function": {"name": "update_claim",
|
|
"description": "Update the notes on the claim.",
|
|
"parameters": {"type": "object",
|
|
"properties": {"claim_id": {"type": "str",
|
|
"description": "The claim number."},
|
|
"notes": {"type": "str",
|
|
"description": "Notes about the claim number for your adjustor to see."}},
|
|
"required": ["claim_id"]}}},
|
|
|
|
{"type": "function",
|
|
"function": {"name": "update_deductible",
|
|
"description": "Update the deductible amount for a specific insurance policy coverage.",
|
|
"parameters": {"type": "object",
|
|
"properties": {"policy_id": {"type": "str",
|
|
"description": "The ID of the insurance policy."},
|
|
"deductible": {"type": "float",
|
|
"description": "The deductible amount set for the policy."}},
|
|
"required": ["policy_id", "deductible"]}}}
|
|
]
|
|
}
|
|
### talk to Arch-Intent directly for completion
|
|
|
|
POST {{model_server_endpoint}}/function_calling HTTP/1.1
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"messages": [
|
|
{
|
|
"role": "user",
|
|
"content": "get me sales opportunities of tech"
|
|
}
|
|
],
|
|
"tools": [
|
|
{
|
|
"type": "function",
|
|
"function":
|
|
{
|
|
"name": "sales_opportunity",
|
|
"description": "Retrieve potential sales opportunities based for a particular industry type in a region.",
|
|
"parameters": {
|
|
"type": "object",
|
|
"properties": {
|
|
"region": {
|
|
"type": "str",
|
|
"description": "Geographical region to identify sales opportunities."
|
|
},
|
|
"industry": {
|
|
"type": "str",
|
|
"description": "Industry type."
|
|
},
|
|
"max_results": {
|
|
"type": "int",
|
|
"description": "Maximum number of sales opportunities to retrieve.",
|
|
"default": 20
|
|
}
|
|
},
|
|
"required": ["region", "industry"]
|
|
}
|
|
}
|
|
|
|
}
|
|
]
|
|
}
|