fix: struct naming and min versions

This commit is contained in:
drbh 2024-03-20 16:30:52 +00:00
parent 7eb3d75df1
commit cd3bd4d9e1
5 changed files with 8 additions and 11 deletions

View File

@ -12,7 +12,7 @@ repository = "https://github.com/huggingface/text-generation-inference"
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.7" python = "^3.7"
pydantic = "> 1.10, < 3" pydantic = "> 2, < 3"
aiohttp = "^3.8" aiohttp = "^3.8"
huggingface-hub = ">= 0.12, < 1.0" huggingface-hub = ">= 0.12, < 1.0"

View File

@ -5,7 +5,7 @@ description = "Text Generation Inference integration tests"
authors = ["Nicolas Patry <nicolas@huggingface.co>"] authors = ["Nicolas Patry <nicolas@huggingface.co>"]
[tool.poetry.dependencies] [tool.poetry.dependencies]
pydantic = "> 1.10, < 3" pydantic = "> 2, < 3"
python = ">=3.9,<3.13" python = ">=3.9,<3.13"
syrupy = "4.0.1" syrupy = "4.0.1"
text-generation = "^0.6.0" text-generation = "^0.6.0"

View File

@ -433,7 +433,7 @@ impl ChatCompletion {
created: u64, created: u64,
details: Details, details: Details,
return_logprobs: bool, return_logprobs: bool,
tool_calls: Option<Vec<ChatCompletionMessageToolCall>>, tool_calls: Option<Vec<ToolCall>>,
) -> Self { ) -> Self {
Self { Self {
id: String::new(), id: String::new(),
@ -764,7 +764,7 @@ pub(crate) struct ChatTemplateInputs<'a> {
} }
#[derive(Clone, Deserialize, Serialize, ToSchema, Default, Debug)] #[derive(Clone, Deserialize, Serialize, ToSchema, Default, Debug)]
pub(crate) struct ChatCompletionMessageToolCall { pub(crate) struct ToolCall {
pub id: u32, pub id: u32,
pub r#type: String, pub r#type: String,
pub function: FunctionDefinition, pub function: FunctionDefinition,
@ -781,7 +781,7 @@ pub(crate) struct Message {
#[schema(example = "\"David\"")] #[schema(example = "\"David\"")]
pub name: Option<String>, pub name: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")] #[serde(default, skip_serializing_if = "Option::is_none")]
pub tool_calls: Option<Vec<ChatCompletionMessageToolCall>>, pub tool_calls: Option<Vec<ToolCall>>,
} }
#[derive(Clone, Debug, Deserialize, ToSchema)] #[derive(Clone, Debug, Deserialize, ToSchema)]

View File

@ -14,10 +14,7 @@ use crate::{
ChatRequest, CompatGenerateRequest, Completion, CompletionComplete, CompletionCompleteChunk, ChatRequest, CompatGenerateRequest, Completion, CompletionComplete, CompletionCompleteChunk,
CompletionRequest, VertexRequest, VertexResponse, CompletionRequest, VertexRequest, VertexResponse,
}; };
use crate::{ use crate::{FunctionDefinition, FunctionRef, FunctionsMap, Properties, ToolCall, ToolType, Tools};
ChatCompletionMessageToolCall, FunctionDefinition, FunctionRef, FunctionsMap, Properties,
ToolType, Tools,
};
use axum::extract::Extension; use axum::extract::Extension;
use axum::http::{HeaderMap, Method, StatusCode}; use axum::http::{HeaderMap, Method, StatusCode};
use axum::response::sse::{Event, KeepAlive, Sse}; use axum::response::sse::{Event, KeepAlive, Sse};
@ -945,7 +942,7 @@ async fn chat_completions(
) )
})?; })?;
let tool_calls = vec![ChatCompletionMessageToolCall { let tool_calls = vec![ToolCall {
id: 0, id: 0,
r#type: "function".to_string(), r#type: "function".to_string(),
function: FunctionDefinition { function: FunctionDefinition {

View File

@ -34,7 +34,7 @@ peft = { version = "^0.9.0", optional = true }
torch = { version = "^2.1.1", optional = true } torch = { version = "^2.1.1", optional = true }
scipy = "^1.11.1" scipy = "^1.11.1"
pillow = "^10.0.0" pillow = "^10.0.0"
outlines= { version = "0.0.36", optional = true } outlines= { version = "^0.0.36", optional = true }
[tool.poetry.extras] [tool.poetry.extras]
torch = ["torch"] torch = ["torch"]