add http files for llm and prompt gateway for local testing (#244)

This commit is contained in:
Adil Hafeez 2024-11-04 17:53:15 -06:00 committed by GitHub
parent e4d5293af4
commit 9a5c5cc3a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 207 additions and 0 deletions

76
api_llm_gateway.rest Normal file
View file

@ -0,0 +1,76 @@
@llm_endpoint = http://localhost:12000
@openai_endpoint = https://api.openai.com
@access_key = {{$dotenv OPENAI_API_KEY}}
### openai request
POST {{openai_endpoint}}/v1/chat/completions HTTP/1.1
Content-Type: application/json
Authorization: Bearer {{access_key}}
{
"messages": [
{
"role": "user",
"content": "hello"
}
],
"model": "gpt-4o-mini"
}
### openai request (streaming)
POST {{openai_endpoint}}/v1/chat/completions HTTP/1.1
Content-Type: application/json
Authorization: Bearer {{access_key}}
{
"messages": [
{
"role": "user",
"content": "hello"
}
],
"model": "gpt-4o-mini",
"stream": true
}
### llm gateway request
POST {{llm_endpoint}}/v1/chat/completions HTTP/1.1
Content-Type: application/json
{
"messages": [
{
"role": "user",
"content": "hello"
}
]
}
### llm gateway request (streaming)
POST {{llm_endpoint}}/v1/chat/completions HTTP/1.1
Content-Type: application/json
{
"messages": [
{
"role": "user",
"content": "hello"
}
],
"stream": true
}
### llm gateway request (provider hint)
POST {{llm_endpoint}}/v1/chat/completions HTTP/1.1
Content-Type: application/json
x-arch-llm-provider-hint: gpt-3.5-turbo-0125
{
"messages": [
{
"role": "user",
"content": "hello"
}
]
}

44
api_model_server.rest Normal file
View file

@ -0,0 +1,44 @@
@model_server_endpoint = http://localhost:51000
@archfc_endpoint = https://api.fc.archgw.com
### talk to model_server for completion
POST {{model_server_endpoint}}/v1/chat/completions HTTP/1.1
Content-Type: application/json
{
"messages": [
{
"role": "user",
"content": "how is the weather in seattle for next 10 days"
}
],
"tools": [
{
"id": "weather-112",
"tool_type": "function",
"function": {
"name": "weather_forecast",
"arguments": {"city": "str", "days": "int"}
}
}
]
}
### talk to arch_fc directly for completion
POST {{archfc_endpoint}}/v1/chat/completions HTTP/1.1
Content-Type: application/json
{
"model": "Arch-Function",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant.\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>\n{\"id\": \"weather-112\", \"tool_type\": \"function\", \"function\": {\"name\": \"weather_forecast\", \"arguments\": {\"city\": \"str\", \"days\": \"int\"}}}\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call>"
},
{ "role": "user", "content": "how is the weather in seattle?" },
{ "role": "assistant", "content": "Of course! " }
],
"continue_final_message": true,
"add_generation_prompt": false
}

87
api_prompt_gateway.rest Normal file
View file

@ -0,0 +1,87 @@
@prompt_endpoint = http://localhost:10000
### prompt gateway request
POST {{prompt_endpoint}}/v1/chat/completions HTTP/1.1
Content-Type: application/json
{
"messages": [
{
"role": "user",
"content": "how is the weather in seattle for next 10 days"
}
]
}
### prompt gateway request (streaming)
POST {{prompt_endpoint}}/v1/chat/completions HTTP/1.1
Content-Type: application/json
{
"messages": [
{
"role": "user",
"content": "how is the weather in seattle for next 10 days"
}
],
"stream": true
}
### prompt gateway request param gathering
POST {{prompt_endpoint}}/v1/chat/completions HTTP/1.1
Content-Type: application/json
{
"messages": [
{
"role": "user",
"content": "how is the weather in seattle"
}
]
}
### prompt gateway request param gathering and function calling
POST {{prompt_endpoint}}/v1/chat/completions HTTP/1.1
Content-Type: application/json
{
"messages": [
{
"role": "user",
"content": "how is the weather in seattle"
},
{
"role": "assistant",
"content": "It seems I'm missing some information. Could you provide the following details days ?",
"model": "Arch-Function-1.5b"
},
{
"role": "user",
"content": "for next 10 days"
}
]
}
### prompt gateway request param gathering and function calling (streaming)
POST {{prompt_endpoint}}/v1/chat/completions HTTP/1.1
Content-Type: application/json
{
"messages": [
{
"role": "user",
"content": "how is the weather in seattle"
},
{
"role": "assistant",
"content": "It seems I'm missing some information. Could you provide the following details days ?",
"model": "Arch-Function-1.5b"
},
{
"role": "user",
"content": "for next 10 days"
}
],
"stream": true
}