vapi_client/models/create_custom_knowledge_base_dto.rs
1/*
2 * Vapi API
3 *
4 * Voice AI for developers.
5 *
6 * The version of the OpenAPI document: 1.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct CreateCustomKnowledgeBaseDto {
16 /// This knowledge base is bring your own knowledge base implementation.
17 #[serde(rename = "provider")]
18 pub provider: ProviderTrue,
19 /// This is where the knowledge base request will be sent. Request Example: POST https://{server.url} Content-Type: application/json { \"messsage\": { \"type\": \"knowledge-base-request\", \"messages\": [ { \"role\": \"user\", \"content\": \"Why is ocean blue?\" } ], ...other metadata about the call... } } Response Expected: ``` { \"message\": { \"role\": \"assistant\", \"content\": \"The ocean is blue because water absorbs everything but blue.\", }, // YOU CAN RETURN THE EXACT RESPONSE TO SPEAK \"documents\": [ { \"content\": \"The ocean is blue primarily because water absorbs colors in the red part of the light spectrum and scatters the blue light, making it more visible to our eyes.\", \"similarity\": 1 }, { \"content\": \"Blue light is scattered more by the water molecules than other colors, enhancing the blue appearance of the ocean.\", \"similarity\": .5 } ] // OR, YOU CAN RETURN AN ARRAY OF DOCUMENTS THAT WILL BE SENT TO THE MODEL } ```
20 #[serde(rename = "server")]
21 pub server: models::Server,
22}
23
24impl CreateCustomKnowledgeBaseDto {
25 pub fn new(provider: ProviderTrue, server: models::Server) -> CreateCustomKnowledgeBaseDto {
26 CreateCustomKnowledgeBaseDto { provider, server }
27 }
28}
29/// This knowledge base is bring your own knowledge base implementation.
30#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
31pub enum ProviderTrue {
32 #[serde(rename = "custom-knowledge-base")]
33 CustomKnowledgeBase,
34}
35
36impl Default for ProviderTrue {
37 fn default() -> ProviderTrue {
38 Self::CustomKnowledgeBase
39 }
40}