fix: bump openapi doc with new grammar option

This commit is contained in:
drbh 2025-03-17 14:51:33 +00:00
parent 71ef9da72c
commit 65c6008847
4 changed files with 36 additions and 9 deletions

View File

@ -1771,6 +1771,24 @@
"type": "string"
}
}
},
{
"type": "object",
"required": [
"type",
"value"
],
"properties": {
"type": {
"type": "string",
"enum": [
"json_schema"
]
},
"value": {
"$ref": "#/components/schemas/JsonSchemaConfig"
}
}
}
],
"discriminator": {
@ -1864,6 +1882,22 @@
}
}
},
"JsonSchemaConfig": {
"type": "object",
"required": [
"schema"
],
"properties": {
"name": {
"type": "string",
"description": "Optional name identifier for the schema",
"nullable": true
},
"schema": {
"description": "The actual JSON schema definition"
}
}
},
"Message": {
"allOf": [
{

View File

@ -222,10 +222,6 @@ struct JsonSchemaConfig {
#[serde(skip_serializing_if = "Option::is_none")]
name: Option<String>,
/// Whether to enforce strict validation (optional)
#[serde(skip_serializing_if = "Option::is_none")]
strict: Option<bool>,
/// The actual JSON schema definition
schema: serde_json::Value,
}

View File

@ -13,7 +13,6 @@ use crate::sagemaker::{
};
use crate::validation::ValidationError;
use crate::vertex::vertex_compatibility;
use crate::ChatTokenizeResponse;
use crate::{
usage_stats, BestOfSequence, Details, ErrorResponse, FinishReason, FunctionName,
GenerateParameters, GenerateRequest, GenerateResponse, GrammarType, HubModelInfo,
@ -28,6 +27,7 @@ use crate::{
ChatRequest, Chunk, CompatGenerateRequest, Completion, CompletionComplete, CompletionFinal,
CompletionRequest, CompletionType, DeltaToolCall, Function, Prompt, Tool,
};
use crate::{ChatTokenizeResponse, JsonSchemaConfig};
use crate::{FunctionDefinition, HubPreprocessorConfig, ToolCall, ToolChoice};
use crate::{MessageBody, ModelInfo, ModelsInfo};
use async_stream::__private::AsyncStream;
@ -1339,6 +1339,7 @@ CompatGenerateRequest,
SagemakerRequest,
GenerateRequest,
GrammarType,
JsonSchemaConfig,
ChatRequest,
Message,
MessageContent,

View File

@ -396,10 +396,6 @@ impl Validation {
"Grammar must have a 'properties' field".to_string(),
))?;
// TODO:
// Apply strictness if specified
let _strict = schema_config.strict.unwrap_or(false);
// Do compilation in the router for performance
let grammar_regex = json_schema_to_regex(json, None, json)
.map_err(ValidationError::RegexFromSchema)?;