plano/tests/rest/api_llm_gateway.rest

122 lines
2.4 KiB
ReStructuredText

@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",
"stream": true
}
### 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"
}
]
}
### llm gateway request with function calling (default target)
POST {{llm_endpoint}}/v1/chat/completions HTTP/1.1
Content-Type: application/json
{
"stream": true,
"model": "None",
"messages": [
{
"role": "user",
"content": "how is the weather in seattle"
}
],
"tools": [
{
"type": "function",
"function": {
"name": "get_current_weather",
"description": "Get current weather at a location.",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The location to get the weather for",
"format": "City, State"
},
"unit": {
"type": "string",
"description": "The unit to return the weather in.",
"enum": ["celsius", "fahrenheit"],
"default": "celsius"
},
"days": {
"type": "string",
"description": "The number of days for the request."
}
},
"required": ["location", "days"]
}
}
}
]
}