langfuse_client_base/models/
chat_prompt.rs

1/*
2 * langfuse
3 *
4 * ## Authentication  Authenticate with the API using [Basic Auth](https://en.wikipedia.org/wiki/Basic_access_authentication), get API keys in the project settings:  - username: Langfuse Public Key - password: Langfuse Secret Key  ## Exports  - OpenAPI spec: https://cloud.langfuse.com/generated/api/openapi.yml - Postman collection: https://cloud.langfuse.com/generated/postman/collection.json
5 *
6 * The version of the OpenAPI document:
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 ChatPrompt {
16    #[serde(rename = "prompt")]
17    pub prompt: Vec<models::ChatMessageWithPlaceholders>,
18    #[serde(rename = "name")]
19    pub name: String,
20    #[serde(rename = "version")]
21    pub version: i32,
22    #[serde(rename = "config", deserialize_with = "Option::deserialize")]
23    pub config: Option<serde_json::Value>,
24    /// List of deployment labels of this prompt version.
25    #[serde(rename = "labels")]
26    pub labels: Vec<String>,
27    /// List of tags. Used to filter via UI and API. The same across versions of a prompt.
28    #[serde(rename = "tags")]
29    pub tags: Vec<String>,
30    /// Commit message for this prompt version.
31    #[serde(
32        rename = "commitMessage",
33        default,
34        with = "::serde_with::rust::double_option",
35        skip_serializing_if = "Option::is_none"
36    )]
37    pub commit_message: Option<Option<String>>,
38    /// The dependency resolution graph for the current prompt. Null if prompt has no dependencies.
39    #[serde(
40        rename = "resolutionGraph",
41        default,
42        with = "::serde_with::rust::double_option",
43        skip_serializing_if = "Option::is_none"
44    )]
45    pub resolution_graph: Option<Option<std::collections::HashMap<String, serde_json::Value>>>,
46}
47
48impl ChatPrompt {
49    pub fn new(
50        prompt: Vec<models::ChatMessageWithPlaceholders>,
51        name: String,
52        version: i32,
53        config: Option<serde_json::Value>,
54        labels: Vec<String>,
55        tags: Vec<String>,
56    ) -> ChatPrompt {
57        ChatPrompt {
58            prompt,
59            name,
60            version,
61            config,
62            labels,
63            tags,
64            commit_message: None,
65            resolution_graph: None,
66        }
67    }
68}