langfuse_rs/models/
create_score_config_request.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 CreateScoreConfigRequest {
16	#[serde(rename = "name")]
17	pub name: String,
18	#[serde(rename = "dataType")]
19	pub data_type: models::ScoreDataType,
20	/// Configure custom categories for categorical scores. Pass a list of objects with `label` and `value` properties. Categories are autogenerated for boolean configs and cannot be passed
21	#[serde(
22		rename = "categories",
23		default,
24		with = "::serde_with::rust::double_option",
25		skip_serializing_if = "Option::is_none"
26	)]
27	pub categories: Option<Option<Vec<models::ConfigCategory>>>,
28	/// Configure a minimum value for numerical scores. If not set, the minimum value defaults to -∞
29	#[serde(
30		rename = "minValue",
31		default,
32		with = "::serde_with::rust::double_option",
33		skip_serializing_if = "Option::is_none"
34	)]
35	pub min_value: Option<Option<f64>>,
36	/// Configure a maximum value for numerical scores. If not set, the maximum value defaults to +∞
37	#[serde(
38		rename = "maxValue",
39		default,
40		with = "::serde_with::rust::double_option",
41		skip_serializing_if = "Option::is_none"
42	)]
43	pub max_value: Option<Option<f64>>,
44	/// Description is shown across the Langfuse UI and can be used to e.g. explain the config categories in detail, why a numeric range was set, or provide additional context on config name or usage
45	#[serde(
46		rename = "description",
47		default,
48		with = "::serde_with::rust::double_option",
49		skip_serializing_if = "Option::is_none"
50	)]
51	pub description: Option<Option<String>>,
52}
53
54impl CreateScoreConfigRequest {
55	pub fn new(name: String, data_type: models::ScoreDataType) -> CreateScoreConfigRequest {
56		CreateScoreConfigRequest {
57			name,
58			data_type,
59			categories: None,
60			min_value: None,
61			max_value: None,
62			description: None,
63		}
64	}
65}