mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-04-19 13:52:07 +00:00
fix: bump openapi doc with new grammar option
This commit is contained in:
parent
71ef9da72c
commit
65c6008847
@ -1771,6 +1771,24 @@
|
|||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"type",
|
||||||
|
"value"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"json_schema"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"$ref": "#/components/schemas/JsonSchemaConfig"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"discriminator": {
|
"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": {
|
"Message": {
|
||||||
"allOf": [
|
"allOf": [
|
||||||
{
|
{
|
||||||
|
@ -222,10 +222,6 @@ struct JsonSchemaConfig {
|
|||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
name: Option<String>,
|
name: Option<String>,
|
||||||
|
|
||||||
/// Whether to enforce strict validation (optional)
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
strict: Option<bool>,
|
|
||||||
|
|
||||||
/// The actual JSON schema definition
|
/// The actual JSON schema definition
|
||||||
schema: serde_json::Value,
|
schema: serde_json::Value,
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,6 @@ use crate::sagemaker::{
|
|||||||
};
|
};
|
||||||
use crate::validation::ValidationError;
|
use crate::validation::ValidationError;
|
||||||
use crate::vertex::vertex_compatibility;
|
use crate::vertex::vertex_compatibility;
|
||||||
use crate::ChatTokenizeResponse;
|
|
||||||
use crate::{
|
use crate::{
|
||||||
usage_stats, BestOfSequence, Details, ErrorResponse, FinishReason, FunctionName,
|
usage_stats, BestOfSequence, Details, ErrorResponse, FinishReason, FunctionName,
|
||||||
GenerateParameters, GenerateRequest, GenerateResponse, GrammarType, HubModelInfo,
|
GenerateParameters, GenerateRequest, GenerateResponse, GrammarType, HubModelInfo,
|
||||||
@ -28,6 +27,7 @@ use crate::{
|
|||||||
ChatRequest, Chunk, CompatGenerateRequest, Completion, CompletionComplete, CompletionFinal,
|
ChatRequest, Chunk, CompatGenerateRequest, Completion, CompletionComplete, CompletionFinal,
|
||||||
CompletionRequest, CompletionType, DeltaToolCall, Function, Prompt, Tool,
|
CompletionRequest, CompletionType, DeltaToolCall, Function, Prompt, Tool,
|
||||||
};
|
};
|
||||||
|
use crate::{ChatTokenizeResponse, JsonSchemaConfig};
|
||||||
use crate::{FunctionDefinition, HubPreprocessorConfig, ToolCall, ToolChoice};
|
use crate::{FunctionDefinition, HubPreprocessorConfig, ToolCall, ToolChoice};
|
||||||
use crate::{MessageBody, ModelInfo, ModelsInfo};
|
use crate::{MessageBody, ModelInfo, ModelsInfo};
|
||||||
use async_stream::__private::AsyncStream;
|
use async_stream::__private::AsyncStream;
|
||||||
@ -1339,6 +1339,7 @@ CompatGenerateRequest,
|
|||||||
SagemakerRequest,
|
SagemakerRequest,
|
||||||
GenerateRequest,
|
GenerateRequest,
|
||||||
GrammarType,
|
GrammarType,
|
||||||
|
JsonSchemaConfig,
|
||||||
ChatRequest,
|
ChatRequest,
|
||||||
Message,
|
Message,
|
||||||
MessageContent,
|
MessageContent,
|
||||||
|
@ -396,10 +396,6 @@ impl Validation {
|
|||||||
"Grammar must have a 'properties' field".to_string(),
|
"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
|
// Do compilation in the router for performance
|
||||||
let grammar_regex = json_schema_to_regex(json, None, json)
|
let grammar_regex = json_schema_to_regex(json, None, json)
|
||||||
.map_err(ValidationError::RegexFromSchema)?;
|
.map_err(ValidationError::RegexFromSchema)?;
|
||||||
|
Loading…
Reference in New Issue
Block a user