Skip to main content

langfuse_client_base/models/
create_comment_request.rs

1/*
2 * server
3 *
4 * ## Real-time data  The only real-time path to get tracing data is to ingest via OpenTelemetry (`POST /api/public/otel/v1/traces`) and retrieve via Observations API v2 (`GET /api/public/v2/observations`) and Metrics API v2 (`GET /api/public/v2/metrics`). Other public API write and read endpoints can delay data by about 10 minutes. Direct OpenTelemetry exporters must send the `x-langfuse-ingestion-version: 4` header; current Python and JS SDKs already do. See the [Public API docs](https://langfuse.com/docs/api-and-data-platform/features/public-api) and [real-time ingestion](https://langfuse.com/integrations/native/opentelemetry.md#real-time-ingestion).  ## 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 - Self-hosted deployments: interactive API reference at `/api/docs` and OpenAPI spec at `/api/openapi.yaml`
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 CreateCommentRequest {
16    /// The id of the project to attach the comment to.
17    #[serde(rename = "projectId")]
18    pub project_id: String,
19    /// The type of the object to attach the comment to (trace, observation, session, prompt).
20    #[serde(rename = "objectType")]
21    pub object_type: String,
22    /// The id of the object to attach the comment to. If this does not reference a valid existing object, an error will be thrown.
23    #[serde(rename = "objectId")]
24    pub object_id: String,
25    /// The content of the comment. May include markdown. Currently limited to 5000 characters.
26    #[serde(rename = "content")]
27    pub content: String,
28    /// The id of the user who created the comment. Must be a member of the organization that owns the project, otherwise an error will be thrown.
29    #[serde(
30        rename = "authorUserId",
31        default,
32        with = "::serde_with::rust::double_option",
33        skip_serializing_if = "Option::is_none"
34    )]
35    pub author_user_id: Option<Option<String>>,
36    /// The start time of the referenced object (for observations, the observation's start time). Optional performance hint - when provided, Langfuse narrows the lookup to validate the reference faster. It only affects speed - an incorrect or omitted value never changes the result.
37    #[serde(
38        rename = "objectStartTime",
39        default,
40        with = "::serde_with::rust::double_option",
41        skip_serializing_if = "Option::is_none"
42    )]
43    pub object_start_time: Option<Option<chrono::DateTime<chrono::FixedOffset>>>,
44}
45
46impl CreateCommentRequest {
47    pub fn new(
48        project_id: String,
49        object_type: String,
50        object_id: String,
51        content: String,
52    ) -> CreateCommentRequest {
53        CreateCommentRequest {
54            project_id,
55            object_type,
56            object_id,
57            content,
58            author_user_id: None,
59            object_start_time: None,
60        }
61    }
62}