diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index d88af51e..8bca6786 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -11,8 +11,10 @@ jobs: uses: actions/checkout@v4 - name: Setup | Rust run: rustup toolchain install stable --profile minimal - - name: Run Clippy + - name: Run Clippy on envoyfilter run: cd envoyfilter && cargo clippy --all-targets --all-features -- -Dwarnings + - name: Run Clippy on public_types + run: cd public_types && cargo clippy --all-targets --all-features -- -Dwarnings format: name: Rustfmt @@ -23,8 +25,10 @@ jobs: uses: actions/checkout@v4 - name: Setup | Rust run: rustup toolchain install stable --profile minimal - - name: Run Rustfmt + - name: Run Rustfmt on envoyfilter run: cd envoyfilter && cargo fmt -p intelligent-prompt-gateway -- --check + - name: Run Rustfmt on public_types + run: cd public_types && cargo fmt -p public_types -- --check test: name: Test @@ -38,5 +42,7 @@ jobs: run: rustup target add wasm32-wasi - name: Build wasm module run: cd envoyfilter && cargo build --release --target=wasm32-wasi - - name: Run Tests + - name: Run Tests on envoyfilter run: cd envoyfilter && cargo test + - name: Run Tests on public_types + run: cd public_types && cargo test diff --git a/public_types/src/common_types.rs b/public_types/src/common_types.rs index 7ee8e974..82693ddc 100644 --- a/public_types/src/common_types.rs +++ b/public_types/src/common_types.rs @@ -25,7 +25,6 @@ pub struct StoreVectorEmbeddingsRequest { pub points: Vec, } - #[derive(Debug, Clone, Serialize, Deserialize)] pub struct SearchPointResult { pub id: String, @@ -124,7 +123,7 @@ pub mod open_ai { pub struct ChatCompletionsResponse { pub usage: Usage, pub choices: Vec, - pub model: String + pub model: String, } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -173,7 +172,7 @@ pub enum PromptGuardTask { #[serde(rename = "toxicity")] Toxicity, #[serde(rename = "both")] - Both + Both, } #[derive(Debug, Clone, Serialize, Deserialize)] diff --git a/public_types/src/configuration.rs b/public_types/src/configuration.rs index 3cef27e7..7e781a79 100644 --- a/public_types/src/configuration.rs +++ b/public_types/src/configuration.rs @@ -148,10 +148,10 @@ system_prompt: | - Use miles per hour for wind speed prompt_guards: - input_guard: - - name: jailbreak + input_guards: + jailbreak: on_exception_message: Looks like you are curious about my abilities… - - name: toxic + toxicity: on_exception_message: Looks like you are curious about my abilities… prompt_targets: @@ -190,7 +190,6 @@ ratelimits: #[test] fn test_deserialize_configuration() { - let c: super::Configuration = serde_yaml::from_str(CONFIGURATION).unwrap(); - assert_eq!(c.prompt_guards.unwrap().input_guard.len(), 2); + let _: super::Configuration = serde_yaml::from_str(CONFIGURATION).unwrap(); } } diff --git a/public_types/src/embeddings/create_embedding_request.rs b/public_types/src/embeddings/create_embedding_request.rs index fba99d31..21e52f8a 100644 --- a/public_types/src/embeddings/create_embedding_request.rs +++ b/public_types/src/embeddings/create_embedding_request.rs @@ -30,7 +30,10 @@ pub struct CreateEmbeddingRequest { } impl CreateEmbeddingRequest { - pub fn new(input: embeddings::CreateEmbeddingRequestInput, model: String) -> CreateEmbeddingRequest { + pub fn new( + input: embeddings::CreateEmbeddingRequestInput, + model: String, + ) -> CreateEmbeddingRequest { CreateEmbeddingRequest { input: Box::new(input), model, diff --git a/public_types/src/embeddings/create_embedding_response.rs b/public_types/src/embeddings/create_embedding_response.rs index ca5e7dd8..278929e0 100644 --- a/public_types/src/embeddings/create_embedding_response.rs +++ b/public_types/src/embeddings/create_embedding_response.rs @@ -27,7 +27,12 @@ pub struct CreateEmbeddingResponse { } impl CreateEmbeddingResponse { - pub fn new(data: Vec, model: String, object: Object, usage: embeddings::CreateEmbeddingResponseUsage) -> CreateEmbeddingResponse { + pub fn new( + data: Vec, + model: String, + object: Object, + usage: embeddings::CreateEmbeddingResponseUsage, + ) -> CreateEmbeddingResponse { CreateEmbeddingResponse { data, model,