Skip to main content

langfuse_client_base/models/
chat_message.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
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, bon::Builder)]
15pub struct ChatMessage {
16    #[serde(rename = "role")]
17    pub role: String,
18    #[serde(rename = "content")]
19    pub content: String,
20    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
21    pub r#type: Option<models::ChatMessageType>,
22}
23
24impl ChatMessage {
25    pub fn new(role: String, content: String) -> ChatMessage {
26        ChatMessage {
27            role,
28            content,
29            r#type: None,
30        }
31    }
32}