Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tgaddair committed Oct 16, 2024
1 parent 3dc7f16 commit b4a9f2e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 38 deletions.
34 changes: 0 additions & 34 deletions router/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -610,40 +610,6 @@ impl From<Message> for TextMessage {
}
}

#[derive(Clone, Debug, Deserialize, ToSchema)]
struct FunctionSpec {
name: String,
description: String,
parameters: serde_json::Value,
}

impl FunctionSpec {
fn to_schema(&self) -> serde_json::Value {
json!({
"type": "object",
"properties": {
"id": {
"type": "string",
},
"type": {
"const": "function",
},
"function": {
"type": "object",
"properties": {
"name": {
"const": self.name,
},
"arguments": self.parameters,
},
"required": ["name", "arguments"],
},
},
"required": ["id", "type", "function"],
})
}
}

#[derive(Clone, Debug, Deserialize, ToSchema)]
struct ChatCompletionRequest {
model: String,
Expand Down
2 changes: 1 addition & 1 deletion router/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ async fn chat_completions_v1(
}

let mut choice_content = vec![];
for (i, gen) in generations.iter().enumerate() {
for (_, gen) in generations.iter().enumerate() {
let (tool_calls, output) = if using_tools {
let gen_text_value: Value = serde_json::from_str(&gen).map_err(|e| {
InferError::ToolError(format!(
Expand Down
4 changes: 1 addition & 3 deletions router/src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ use crate::adapter::Adapter;
use crate::batch::ValidGenerateRequest;
use crate::config::Config;
use crate::validation::ValidationError::{BestOfSampling, BestOfSeed, EmptyInput};
use crate::{
GenerateParameters, GenerateRequest, HubPreprocessorConfig, Idefics2Preprocessor, Tool,
};
use crate::{GenerateParameters, GenerateRequest, HubPreprocessorConfig, Idefics2Preprocessor};
use base64::{engine::general_purpose::STANDARD, Engine};
use image::{ImageFormat, ImageReader};
use lorax_client::{NextTokenChooserParameters, StoppingCriteriaParameters, TokenizedInputs};
Expand Down

0 comments on commit b4a9f2e

Please sign in to comment.