fully convert the input message types to the openai message types

previously the types were passed around as TypedDicts and converted to dicts
This commit is contained in:
Matthew Farrellee 2025-10-01 21:32:04 -04:00
parent 0327ef3daf
commit 0399f89c1f
32 changed files with 12183 additions and 4 deletions

View file

@ -0,0 +1,168 @@
{
"request": {
"method": "POST",
"url": "http://0.0.0.0:11434/v1/v1/chat/completions",
"headers": {},
"body": {
"model": "llama3.2:3b-instruct-fp16",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Say hi to the world. Use tools to do so."
},
{
"role": "assistant",
"content": "",
"tool_calls": [
{
"id": "call_b3bu19d8",
"type": "function",
"function": {
"name": "greet_everyone",
"arguments": "{\"url\": \"world\"}"
}
}
]
},
{
"role": "tool",
"tool_call_id": "call_b3bu19d8",
"content": [
{
"type": "text",
"text": "Hello, world!"
}
]
},
{
"role": "assistant",
"content": "<|python_tag|>{\"name\": \"get_language_info\", \"parameters\": {\"lang\": \"python\"}}"
},
{
"role": "user",
"content": "What is the boiling point of polyjuice? Use tools to answer."
}
],
"max_tokens": 0,
"stream": true,
"tool_choice": "auto",
"tools": [
{
"type": "function",
"function": {
"name": "greet_everyone",
"parameters": {
"type": "object",
"properties": {
"url": {
"type": "string",
"title": "Url"
}
},
"required": [
"url"
]
}
}
},
{
"type": "function",
"function": {
"name": "get_boiling_point",
"description": "\n Returns the boiling point of a liquid in Celsius or Fahrenheit.\n\n :param liquid_name: The name of the liquid\n :param celsius: Whether to return the boiling point in Celsius\n :return: The boiling point of the liquid in Celcius or Fahrenheit\n ",
"parameters": {
"type": "object",
"properties": {
"liquid_name": {
"type": "string",
"title": "Liquid Name"
},
"celsius": {
"type": "boolean",
"default": true,
"title": "Celsius"
}
},
"required": [
"liquid_name"
]
}
}
}
]
},
"endpoint": "/v1/chat/completions",
"model": "llama3.2:3b-instruct-fp16"
},
"response": {
"body": [
{
"__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
"__data__": {
"id": "chatcmpl-534",
"choices": [
{
"delta": {
"content": "",
"function_call": null,
"refusal": null,
"role": "assistant",
"tool_calls": [
{
"index": 0,
"id": "call_pe0enwmn",
"function": {
"arguments": "{\"celsius\":\"true\",\"liquid_name\":\"polyjuice\"}",
"name": "get_boiling_point"
},
"type": "function"
}
]
},
"finish_reason": null,
"index": 0,
"logprobs": null
}
],
"created": 1759368463,
"model": "llama3.2:3b-instruct-fp16",
"object": "chat.completion.chunk",
"service_tier": null,
"system_fingerprint": "fp_ollama",
"usage": null
}
},
{
"__type__": "openai.types.chat.chat_completion_chunk.ChatCompletionChunk",
"__data__": {
"id": "chatcmpl-534",
"choices": [
{
"delta": {
"content": "",
"function_call": null,
"refusal": null,
"role": "assistant",
"tool_calls": null
},
"finish_reason": "tool_calls",
"index": 0,
"logprobs": null
}
],
"created": 1759368463,
"model": "llama3.2:3b-instruct-fp16",
"object": "chat.completion.chunk",
"service_tier": null,
"system_fingerprint": "fp_ollama",
"usage": null
}
}
],
"is_streaming": true
}
}