mirror of
https://github.com/katanemo/plano.git
synced 2026-05-05 05:42:49 +02:00
Fix bug in PromptGuard configuration (#80)
Signed-off-by: José Ulises Niño Rivera <junr03@users.noreply.github.com>
This commit is contained in:
parent
7d130e102a
commit
370f3bb2c5
5 changed files with 25 additions and 13 deletions
|
|
@ -25,7 +25,6 @@ pub struct StoreVectorEmbeddingsRequest {
|
|||
pub points: Vec<VectorPoint>,
|
||||
}
|
||||
|
||||
|
||||
#[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<Choice>,
|
||||
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)]
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -27,7 +27,12 @@ pub struct CreateEmbeddingResponse {
|
|||
}
|
||||
|
||||
impl CreateEmbeddingResponse {
|
||||
pub fn new(data: Vec<embeddings::Embedding>, model: String, object: Object, usage: embeddings::CreateEmbeddingResponseUsage) -> CreateEmbeddingResponse {
|
||||
pub fn new(
|
||||
data: Vec<embeddings::Embedding>,
|
||||
model: String,
|
||||
object: Object,
|
||||
usage: embeddings::CreateEmbeddingResponseUsage,
|
||||
) -> CreateEmbeddingResponse {
|
||||
CreateEmbeddingResponse {
|
||||
data,
|
||||
model,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue