Skip to content

(feat) Always use json schema to validate response body when available #21

@danwritecode

Description

@danwritecode

Currently, we DO validate the JSON response with json schema if one is given. However, this requires the model itself to support JSON schema. We should still allow users to provide JSON schema and we should validate the response body even in situations when the model doesn't support json schema.

The important thing here is that we do not pass "json_schema" to the model otherwise it will bomb. We should only use it for validation purposes. Currently in llm.rs we are doing exactly this, so some small tweaks are needed to make this a reality.

This also allows use to dynamically and automatically pass in the JSON schema to the end of the prompt so that you don't have to manually embed the JSON schema into the prompt itself. We again currently do this when building the LlmRequest struct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions