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 : Support AWS bedrock base models #25

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ axum-prometheus = "0.7.0"
reqwest-streams = { version = "0.8.1", features = ["json"] }
futures = "0.3.31"
async-stream = "0.3.6"
aws-config = "1.5.12"
aws-sdk-bedrockruntime = "1.66.0"
aws-credential-types = "1.2.1"
15 changes: 15 additions & 0 deletions src/config/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,18 @@ pub fn default_max_tokens() -> u32 {
.parse()
.unwrap_or(4096)
}

// Required field for the TitanEmbeddingRequest
pub fn default_embedding_dimension() -> u32 {
env::var("DEFAULT_EMBEDDING_DIMENSION")
.unwrap_or_else(|_| "512".to_string())
.parse()
.unwrap_or(512)
}
// Required field for the TitanEmbeddingRequest
pub fn default_embedding_normalize() -> bool {
env::var("DEFAULT_EMBEDDING_NORMALIZE")
.unwrap_or_else(|_| "true".to_string())
.parse()
.unwrap_or(true)
}
3 changes: 2 additions & 1 deletion src/providers/anthropic/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
mod models;
pub(crate) mod models;
mod provider;

pub use provider::AnthropicProvider;
pub use models::{AnthropicChatCompletionRequest, AnthropicChatCompletionResponse};
4 changes: 2 additions & 2 deletions src/providers/anthropic/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::models::tool_calls::{ChatMessageToolCall, FunctionCall};
use serde::{Deserialize, Serialize};

#[derive(Deserialize, Serialize, Clone)]
pub(crate) struct AnthropicChatCompletionRequest {
pub struct AnthropicChatCompletionRequest {
pub max_tokens: u32,
pub model: String,
pub messages: Vec<ChatCompletionMessage>,
Expand All @@ -23,7 +23,7 @@ pub(crate) struct AnthropicChatCompletionRequest {
}

#[derive(Deserialize, Serialize, Clone)]
pub(crate) struct AnthropicChatCompletionResponse {
pub struct AnthropicChatCompletionResponse {
pub id: String,
pub model: String,
pub content: Vec<ContentBlock>,
Expand Down
6 changes: 6 additions & 0 deletions src/providers/bedrock/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
mod models;

mod provider;
mod test;

pub use provider::BedrockProvider;
Loading