Skip to content

Commit

Permalink
fix: struct naming and min versions
Browse files Browse the repository at this point in the history
  • Loading branch information
drbh committed Mar 20, 2024
1 parent 7eb3d75 commit cd3bd4d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion clients/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repository = "https://github.com/huggingface/text-generation-inference"

[tool.poetry.dependencies]
python = "^3.7"
pydantic = "> 1.10, < 3"
pydantic = "> 2, < 3"
aiohttp = "^3.8"
huggingface-hub = ">= 0.12, < 1.0"

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description = "Text Generation Inference integration tests"
authors = ["Nicolas Patry <[email protected]>"]

[tool.poetry.dependencies]
pydantic = "> 1.10, < 3"
pydantic = "> 2, < 3"
python = ">=3.9,<3.13"
syrupy = "4.0.1"
text-generation = "^0.6.0"
Expand Down
6 changes: 3 additions & 3 deletions router/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ impl ChatCompletion {
created: u64,
details: Details,
return_logprobs: bool,
tool_calls: Option<Vec<ChatCompletionMessageToolCall>>,
tool_calls: Option<Vec<ToolCall>>,
) -> Self {
Self {
id: String::new(),
Expand Down Expand Up @@ -764,7 +764,7 @@ pub(crate) struct ChatTemplateInputs<'a> {
}

#[derive(Clone, Deserialize, Serialize, ToSchema, Default, Debug)]
pub(crate) struct ChatCompletionMessageToolCall {
pub(crate) struct ToolCall {
pub id: u32,
pub r#type: String,
pub function: FunctionDefinition,
Expand All @@ -781,7 +781,7 @@ pub(crate) struct Message {
#[schema(example = "\"David\"")]
pub name: Option<String>,
#[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)]
Expand Down
7 changes: 2 additions & 5 deletions router/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ use crate::{
ChatRequest, CompatGenerateRequest, Completion, CompletionComplete, CompletionCompleteChunk,
CompletionRequest, VertexRequest, VertexResponse,
};
use crate::{
ChatCompletionMessageToolCall, FunctionDefinition, FunctionRef, FunctionsMap, Properties,
ToolType, Tools,
};
use crate::{FunctionDefinition, FunctionRef, FunctionsMap, Properties, ToolCall, ToolType, Tools};
use axum::extract::Extension;
use axum::http::{HeaderMap, Method, StatusCode};
use axum::response::sse::{Event, KeepAlive, Sse};
Expand Down Expand Up @@ -945,7 +942,7 @@ async fn chat_completions(
)
})?;

let tool_calls = vec![ChatCompletionMessageToolCall {
let tool_calls = vec![ToolCall {
id: 0,
r#type: "function".to_string(),
function: FunctionDefinition {
Expand Down
2 changes: 1 addition & 1 deletion server/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ peft = { version = "^0.9.0", optional = true }
torch = { version = "^2.1.1", optional = true }
scipy = "^1.11.1"
pillow = "^10.0.0"
outlines= { version = "0.0.36", optional = true }
outlines= { version = "^0.0.36", optional = true }

[tool.poetry.extras]
torch = ["torch"]
Expand Down

0 comments on commit cd3bd4d

Please sign in to comment.