Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading/wrong openapi schema in REST API docs for structured output #389

Open
2 of 4 tasks
oscarjohansson94 opened this issue Apr 5, 2024 · 0 comments
Open
2 of 4 tasks
Assignees

Comments

@oscarjohansson94
Copy link

System Info

Running image ghcr.io/predibase/lorax:0.9.0 in kubernetes.

Information

  • Docker
  • The CLI directly

Tasks

  • An officially supported command
  • My own modifications

Reproduction

Using the /generate endpoint.

When reading the swagger at: REST API, the property schema is defined as
"schema": "{\"type\": \"string\", \"title\": \"response\"}",

This makes me believe that this parameter would be responsible for enforcing structured output, as described in Structured Output. However, when setting it to any schema (using pydantics .model_json_schema() or by passing a json schema directly) the schema is not enforced on the generated text. This is the only parameter in the swagger for this endpoints that I would relate to structured output.

However, if you pass the parameter "response_format", structured output is enabled. An example would be

{
  "inputs": "prompt",
  "parameters": {
    "adapter_id": "/some/adapter",
    "adapter_source": "local",
    "response_format": {
      "type": "json_object",
      "schema": {
        "$defs": ...,
        "additionalProperties": false, 
        "properties": ...,
        "title": "ExampleObject",
        "type": "object"}
    }
}

This is not present in the swagger for /generate or any other documentation that I could find for the endpoint. I only tested it because of the example in Structured Output, where a Python Client is used.

Expected behavior

I expected the documentation to more clear on how to enable structured output in the /generate endpoint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants