Skip to content

Commit

Permalink
Support structured outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
domenkozar committed Aug 12, 2024
1 parent 6d70a33 commit feb270e
Show file tree
Hide file tree
Showing 2 changed files with 675 additions and 665 deletions.
6 changes: 5 additions & 1 deletion async-openai/src/types/assistant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,11 @@ pub enum AssistantsApiResponseFormatOption {
/// An object describing the expected output of the model. If `json_object` only `function` type `tools` are allowed to be passed to the Run. If `text` the model can return text or any value needed.
#[derive(Clone, Serialize, Debug, Deserialize, PartialEq, Default)]
pub struct AssistantsApiResponseFormat {
/// Must be one of `text` or `json_object`.
/// Must be one of `text`, `json_object` or `json_schema`.
pub r#type: AssistantsApiResponseFormatType,

#[serde(skip_serializing_if = "Option::is_none")]
pub json_schema: Option<serde_json::Value>,
}

#[derive(Clone, Serialize, Debug, Deserialize, PartialEq, Default)]
Expand All @@ -139,6 +142,7 @@ pub enum AssistantsApiResponseFormatType {
#[default]
Text,
JsonObject,
JsonSchema,
}

/// Retrieval tool
Expand Down
Loading

0 comments on commit feb270e

Please sign in to comment.