Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(backend): add support for Anthropic model implementation #3687

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Prev Previous commit
Next Next commit
fix(azure): update default API version for Azure integration
Sma1lboy committed Jan 14, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 5383bfc782cfd38d8f3fef85abd71a97d42a82ad
7 changes: 1 addition & 6 deletions crates/http-api-bindings/src/chat/mod.rs
Original file line number Diff line number Diff line change
@@ -18,12 +18,7 @@ pub async fn create(model: &HttpModelConfig) -> Arc<dyn ChatCompletionStream> {
let config = async_openai_alt::config::AzureConfig::new()
.with_api_base(api_endpoint)
.with_api_key(model.api_key.clone().unwrap_or_default())
.with_api_version(
model
.api_version
.clone()
.unwrap_or("2024-05-01-preview".to_string()),
)
.with_api_version("2024-08-01-preview")
.with_deployment_id(model.model_name.as_deref().expect("Model name is required"));
Box::new(
async_openai_alt::Client::with_config(config)
2 changes: 1 addition & 1 deletion crates/http-api-bindings/src/embedding/azure.rs
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ impl AzureEmbeddingEngine {
client: Arc::new(client),
api_endpoint: azure_endpoint,
api_key: api_key.unwrap_or_default().to_owned(),
api_version: api_version.unwrap_or("2024-02-15-preview").to_owned(),
api_version: api_version.unwrap_or("2023-05-15").to_owned(),
})
}
}
4 changes: 2 additions & 2 deletions crates/http-api-bindings/src/embedding/mod.rs
Original file line number Diff line number Diff line change
@@ -48,8 +48,8 @@ pub async fn create(config: &HttpModelConfig) -> Arc<dyn Embedding> {
.as_deref()
.expect("api_endpoint is required for azure/embedding"),
config.model_name.as_deref().unwrap_or_default(), // Provide a default if model_name is optional
config.api_key.as_deref(), // Pass the API key if available
config.api_version.as_deref(), // Pass the API version if available
config.api_key.as_deref(),
Some("2023-05-15"),
),
unsupported_kind => panic!(
"Unsupported kind for http embedding model: {}",
5 changes: 0 additions & 5 deletions crates/tabby-common/src/config.rs
Original file line number Diff line number Diff line change
@@ -310,11 +310,6 @@ pub struct HttpModelConfig {

#[builder(default)]
pub additional_stop_words: Option<Vec<String>>,

/// Used For Azure API to specify the api version
#[builder(default)]
#[serde(default)]
pub api_version: Option<String>,
}

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]