Skip to main content

langfuse_client_base/models/
dataset.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, bon::Builder)]
15pub struct Dataset {
16    #[serde(rename = "id")]
17    pub id: String,
18    #[serde(rename = "name")]
19    pub name: String,
20    /// Description of the dataset
21    #[serde(
22        rename = "description",
23        default,
24        with = "::serde_with::rust::double_option",
25        skip_serializing_if = "Option::is_none"
26    )]
27    pub description: Option<Option<String>>,
28    /// Metadata associated with the dataset
29    #[serde(rename = "metadata", deserialize_with = "Option::deserialize")]
30    pub metadata: Option<serde_json::Value>,
31    /// JSON Schema for validating dataset item inputs
32    #[serde(
33        rename = "inputSchema",
34        default,
35        with = "::serde_with::rust::double_option",
36        skip_serializing_if = "Option::is_none"
37    )]
38    pub input_schema: Option<Option<serde_json::Value>>,
39    /// JSON Schema for validating dataset item expected outputs
40    #[serde(
41        rename = "expectedOutputSchema",
42        default,
43        with = "::serde_with::rust::double_option",
44        skip_serializing_if = "Option::is_none"
45    )]
46    pub expected_output_schema: Option<Option<serde_json::Value>>,
47    #[serde(rename = "projectId")]
48    pub project_id: String,
49    #[serde(rename = "createdAt")]
50    pub created_at: String,
51    #[serde(rename = "updatedAt")]
52    pub updated_at: String,
53}
54
55impl Dataset {
56    pub fn new(
57        id: String,
58        name: String,
59        metadata: Option<serde_json::Value>,
60        project_id: String,
61        created_at: String,
62        updated_at: String,
63    ) -> Dataset {
64        Dataset {
65            id,
66            name,
67            description: None,
68            metadata,
69            input_schema: None,
70            expected_output_schema: None,
71            project_id,
72            created_at,
73            updated_at,
74        }
75    }
76}