Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 37 additions & 4 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,16 @@ components:
required: true
schema:
type: string
LLMObsPromptEnvironmentQueryParameter:
description: >-
Optional `DD_ENV` value used to resolve the prompt version deployed to the matching Feature Flags environment. This value is not a Feature Flags environment UUID. Using this parameter additionally requires the `feature_flag_config_read` and `feature_flag_environment_config_read` permissions. This parameter cannot be used with `label`.
example: production
in: query
name: environment
required: false
schema:
minLength: 1
type: string
LLMObsPromptIDPathParameter:
description: The customer-provided identifier of the Agent Observability prompt.
example: "customer-support-assistant"
Expand All @@ -1090,7 +1100,7 @@ components:
type: string
LLMObsPromptLabelQueryParameter:
description: >-
**Deprecated.** Optional label of the prompt version to return. Do not use this parameter for new integrations. If omitted, the latest version is returned. If the prompt has no labels, the latest version is returned even when a label is requested. If the prompt has labels but none match the requested label, a 404 response is returned.
**Deprecated.** Optional label of the prompt version to return. Do not use this parameter for new integrations. If omitted, the latest version is returned. If the prompt has no labels, the latest version is returned even when a label is requested. If the prompt has labels but none match the requested label, a 404 response is returned. This parameter cannot be used with `environment`.
in: query
name: label
required: false
Expand Down Expand Up @@ -167110,11 +167120,13 @@ paths:
**Note**: This endpoint is in preview and is subject to change.
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
get:
description: Get the latest version of an Agent Observability prompt by prompt ID.
description: >-
Get an Agent Observability prompt by prompt ID. When `environment` is omitted, this returns the latest version or uses the deprecated `label` behavior and requires `llm_observability_read`. When `environment` is supplied, it must be a nonempty `DD_ENV` value, cannot be combined with `label`, and additionally requires `feature_flag_config_read` and `feature_flag_environment_config_read`. An empty environment or combining it with `label` returns 400, and missing either additional permission returns 403. A missing prompt or deployment returns 404 without falling back to the latest version. An environment resolution failure returns 500.
operationId: GetLLMObsPrompt
parameters:
- $ref: "#/components/parameters/LLMObsPromptIDPathParameter"
- $ref: "#/components/parameters/LLMObsPromptLabelQueryParameter"
- $ref: "#/components/parameters/LLMObsPromptEnvironmentQueryParameter"
responses:
"200":
content:
Expand All @@ -167137,6 +167149,14 @@ paths:
schema:
$ref: "#/components/schemas/LLMObsPromptSDKResponse"
description: OK
"400":
content:
application/json:
schema:
$ref: "#/components/schemas/JSONAPIErrorResponse"
description: |-
Bad Request
The environment is empty, or environment and label are both supplied.
"401":
content:
application/json:
Expand All @@ -167148,15 +167168,28 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/JSONAPIErrorResponse"
description: Forbidden
description: |-
Forbidden
The application key lacks `llm_observability_read`, or environment resolution was requested without both
`feature_flag_config_read` and `feature_flag_environment_config_read`.
"404":
content:
application/json:
schema:
$ref: "#/components/schemas/JSONAPIErrorResponse"
description: Not Found
description: |-
Not Found
The prompt does not exist, or no prompt deployment can be resolved for the supplied environment.
"429":
$ref: "#/components/responses/TooManyRequestsResponse"
"500":
content:
application/json:
schema:
$ref: "#/components/schemas/JSONAPIErrorResponse"
description: |-
Internal Server Error
Environment resolution failed.
security:
- apiKeyAuth: []
appKeyAuth: []
Expand Down
22 changes: 22 additions & 0 deletions examples/v2_agent-observability_GetLLMObsPrompt_2452494832.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Get an Agent Observability prompt by environment returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_agent_observability::AgentObservabilityAPI;
use datadog_api_client::datadogV2::api_agent_observability::GetLLMObsPromptOptionalParams;

#[tokio::main]
async fn main() {
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.GetLLMObsPrompt", true);
let api = AgentObservabilityAPI::with_config(configuration);
let resp = api
.get_llm_obs_prompt(
"prompt_id".to_string(),
GetLLMObsPromptOptionalParams::default().environment("production".to_string()),
)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
20 changes: 16 additions & 4 deletions src/datadogV2/api/api_agent_observability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,23 @@ impl GetLLMObsAnnotatedInteractionsByTraceIDsOptionalParams {
#[non_exhaustive]
#[derive(Clone, Default, Debug)]
pub struct GetLLMObsPromptOptionalParams {
/// **Deprecated.** Optional label of the prompt version to return. Do not use this parameter for new integrations. If omitted, the latest version is returned. If the prompt has no labels, the latest version is returned even when a label is requested. If the prompt has labels but none match the requested label, a 404 response is returned.
/// **Deprecated.** Optional label of the prompt version to return. Do not use this parameter for new integrations. If omitted, the latest version is returned. If the prompt has no labels, the latest version is returned even when a label is requested. If the prompt has labels but none match the requested label, a 404 response is returned. This parameter cannot be used with `environment`.
pub label: Option<String>,
/// Optional `DD_ENV` value used to resolve the prompt version deployed to the matching Feature Flags environment. This value is not a Feature Flags environment UUID. Using this parameter additionally requires the `feature_flag_config_read` and `feature_flag_environment_config_read` permissions. This parameter cannot be used with `label`.
pub environment: Option<String>,
}

impl GetLLMObsPromptOptionalParams {
/// **Deprecated.** Optional label of the prompt version to return. Do not use this parameter for new integrations. If omitted, the latest version is returned. If the prompt has no labels, the latest version is returned even when a label is requested. If the prompt has labels but none match the requested label, a 404 response is returned.
/// **Deprecated.** Optional label of the prompt version to return. Do not use this parameter for new integrations. If omitted, the latest version is returned. If the prompt has no labels, the latest version is returned even when a label is requested. If the prompt has labels but none match the requested label, a 404 response is returned. This parameter cannot be used with `environment`.
pub fn label(mut self, value: String) -> Self {
self.label = Some(value);
self
}
/// Optional `DD_ENV` value used to resolve the prompt version deployed to the matching Feature Flags environment. This value is not a Feature Flags environment UUID. Using this parameter additionally requires the `feature_flag_config_read` and `feature_flag_environment_config_read` permissions. This parameter cannot be used with `label`.
pub fn environment(mut self, value: String) -> Self {
self.environment = Some(value);
self
}
}

/// ListLLMObsAnnotationQueuesOptionalParams is a struct for passing parameters to the method [`AgentObservabilityAPI::list_llm_obs_annotation_queues`]
Expand Down Expand Up @@ -5786,7 +5793,7 @@ impl AgentObservabilityAPI {
}
}

/// Get the latest version of an Agent Observability prompt by prompt ID.
/// Get an Agent Observability prompt by prompt ID. When `environment` is omitted, this returns the latest version or uses the deprecated `label` behavior and requires `llm_observability_read`. When `environment` is supplied, it must be a nonempty `DD_ENV` value, cannot be combined with `label`, and additionally requires `feature_flag_config_read` and `feature_flag_environment_config_read`. An empty environment or combining it with `label` returns 400, and missing either additional permission returns 403. A missing prompt or deployment returns 404 without falling back to the latest version. An environment resolution failure returns 500.
pub async fn get_llm_obs_prompt(
&self,
prompt_id: String,
Expand All @@ -5812,7 +5819,7 @@ impl AgentObservabilityAPI {
}
}

/// Get the latest version of an Agent Observability prompt by prompt ID.
/// Get an Agent Observability prompt by prompt ID. When `environment` is omitted, this returns the latest version or uses the deprecated `label` behavior and requires `llm_observability_read`. When `environment` is supplied, it must be a nonempty `DD_ENV` value, cannot be combined with `label`, and additionally requires `feature_flag_config_read` and `feature_flag_environment_config_read`. An empty environment or combining it with `label` returns 400, and missing either additional permission returns 403. A missing prompt or deployment returns 404 without falling back to the latest version. An environment resolution failure returns 500.
pub async fn get_llm_obs_prompt_with_http_info(
&self,
prompt_id: String,
Expand All @@ -5834,6 +5841,7 @@ impl AgentObservabilityAPI {

// unbox and build optional parameters
let label = params.label;
let environment = params.environment;

let local_client = &self.client;

Expand All @@ -5849,6 +5857,10 @@ impl AgentObservabilityAPI {
local_req_builder =
local_req_builder.query(&[("label", &local_query_param.to_string())]);
};
if let Some(ref local_query_param) = environment {
local_req_builder =
local_req_builder.query(&[("environment", &local_query_param.to_string())]);
};

// build headers
let mut headers = HeaderMap::new();
Expand Down
17 changes: 17 additions & 0 deletions tests/scenarios/features/v2/agent_observability.feature
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,23 @@ Feature: Agent Observability
When the request is sent
Then the response status is 200 OK

@skip @team:DataDog/ml-observability
Scenario: Get an Agent Observability prompt by environment returns "OK" response
Given operation "GetLLMObsPrompt" enabled
And new "GetLLMObsPrompt" request
And request contains "prompt_id" parameter from "REPLACE.ME"
And request contains "environment" parameter with value "production"
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/ml-observability
Scenario: Get an Agent Observability prompt returns "Bad Request" response
Given operation "GetLLMObsPrompt" enabled
And new "GetLLMObsPrompt" request
And request contains "prompt_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/ml-observability
Scenario: Get an Agent Observability prompt returns "Not Found" response
Given operation "GetLLMObsPrompt" enabled
Expand Down
4 changes: 4 additions & 0 deletions tests/scenarios/function_mappings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17186,8 +17186,12 @@ fn test_v2_get_llm_obs_prompt(world: &mut DatadogWorld, _parameters: &HashMap<St
let label = _parameters
.get("label")
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
let environment = _parameters
.get("environment")
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
let mut params = datadogV2::api_agent_observability::GetLLMObsPromptOptionalParams::default();
params.label = label;
params.environment = environment;
let response = match block_on(api.get_llm_obs_prompt_with_http_info(prompt_id, params)) {
Ok(response) => response,
Err(error) => {
Expand Down
Loading