Skip to content

Commit

Permalink
feat: update to 0.47.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaro00 committed Jul 22, 2024
1 parent 1008805 commit d8130c2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
6 changes: 4 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -622,11 +622,12 @@ workflows:
parameters:
path:
- resources/aws-rds
- resources/openai
- resources/opendal
- resources/persist
- resources/qdrant
- resources/shared-db
- resources/turso
- resources/opendal
- services/shuttle-actix-web
- services/shuttle-axum
- services/shuttle-poem
Expand Down Expand Up @@ -883,11 +884,12 @@ workflows:
parameters:
path:
- resources/aws-rds
- resources/openai
- resources/opendal
- resources/persist
- resources/qdrant
- resources/shared-db
- resources/turso
- resources/opendal
name: publish-<< matrix.path >>
requires:
- publish-service
Expand Down
7 changes: 3 additions & 4 deletions resources/openai/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "shuttle-openai"
version = "0.45.0"
version = "0.47.0"
edition = "2021"
license = "Apache-2.0"
description = "Shuttle plugin for connecting to OpenAI"
Expand All @@ -10,7 +10,6 @@ keywords = ["shuttle-service", "openai"]
[dependencies]
async-openai = "0.23.0"
async-trait = "0.1.56"
serde_json = "1"
shuttle-service = { path = "../../service", version = "0.45.0" }
serde = { version = "1.0.203", features = ["derive"] }
secrecy = "0.8.0"
serde_json = "1"
shuttle-service = { path = "../../service", version = "0.47.0" }
10 changes: 5 additions & 5 deletions resources/openai/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ use async_openai::Client;
use async_trait::async_trait;
use serde::{Deserialize, Serialize};
use shuttle_service::{
CustomError, Error, IntoResource, ResourceFactory, ResourceInputBuilder, Secret,
CustomError, Error, IntoResource, ResourceFactory, ResourceInputBuilder,
};

pub use async_openai;

#[derive(Default, Serialize)]
pub struct OpenAI {
api_base: Option<String>,
api_key: Option<Secret<String>>,
api_key: Option<String>,
org_id: Option<String>,
project_id: Option<String>,
}
Expand All @@ -22,7 +22,7 @@ impl OpenAI {
self
}
pub fn api_key(mut self, api_key: &str) -> Self {
self.api_key = Some(api_key.to_string().into());
self.api_key = Some(api_key.to_string());
self
}
pub fn org_id(mut self, org_id: &str) -> Self {
Expand All @@ -38,7 +38,7 @@ impl OpenAI {
#[derive(Serialize, Deserialize)]
pub struct Config {
api_base: Option<String>,
api_key: Secret<String>,
api_key: String,
org_id: Option<String>,
project_id: Option<String>,
}
Expand All @@ -65,7 +65,7 @@ impl ResourceInputBuilder for OpenAI {
#[async_trait]
impl IntoResource<Client<OpenAIConfig>> for Config {
async fn into_resource(self) -> Result<Client<OpenAIConfig>, Error> {
let mut openai_config = OpenAIConfig::new().with_api_key(self.api_key.expose());
let mut openai_config = OpenAIConfig::new().with_api_key(self.api_key);
if let Some(api_base) = self.api_base {
openai_config = openai_config.with_api_base(api_base)
}
Expand Down

0 comments on commit d8130c2

Please sign in to comment.