OoriData / Toolio

AI API implementation for Mac which supports tool-calling & other structured LLM response generation (e.g. conform to JSON schema)
74 stars 2 forks source link

Comply with OpenAI server by making schema optional. #5

Closed namin closed 1 month ago

namin commented 1 month ago

Using microsoft/graphrag, I was getting errors like

{"status_code":10422,"message":"[{'type': 'missing', 'loc': ('body', 'response_format', 'schema'), 'msg': 'Field required', 'input': {'type': 'json_object'}}]","data":null}

This query, while without an explicit schema, is a valid OpenAI query and should be supported:

curl -X POST "http://localhost:8000/v1/chat/completions" \
  -H 'Content-Type: application/json' \
  -d '{
    "messages": [{"role": "user", "content": "I am thinking of a number between 1 and 10. Guess what it is."}],
    "response_format": {
        "type": "json_object"
    },
    "temperature": 0.1
   }'
uogbuji commented 1 month ago

You're right, of course. I think I broke that when I fixed the schema alias. Thanks for the patch!