Skip to content
Merged
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
870 changes: 870 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

129 changes: 129 additions & 0 deletions examples/v2_llm-observability_CreateLLMObsIntegrationInference.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
// Run an LLM inference returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_llm_observability::LLMObservabilityAPI;
use datadog_api_client::datadogV2::model::LLMObsAnthropicEffort;
use datadog_api_client::datadogV2::model::LLMObsAnthropicMetadata;
use datadog_api_client::datadogV2::model::LLMObsAnthropicThinkingConfig;
use datadog_api_client::datadogV2::model::LLMObsAnthropicThinkingType;
use datadog_api_client::datadogV2::model::LLMObsAzureOpenAIMetadata;
use datadog_api_client::datadogV2::model::LLMObsBedrockMetadata;
use datadog_api_client::datadogV2::model::LLMObsInferenceContent;
use datadog_api_client::datadogV2::model::LLMObsInferenceContentValue;
use datadog_api_client::datadogV2::model::LLMObsInferenceFunction;
use datadog_api_client::datadogV2::model::LLMObsInferenceMessage;
use datadog_api_client::datadogV2::model::LLMObsInferenceTool;
use datadog_api_client::datadogV2::model::LLMObsInferenceToolCall;
use datadog_api_client::datadogV2::model::LLMObsInferenceToolResult;
use datadog_api_client::datadogV2::model::LLMObsIntegrationInferenceRequest;
use datadog_api_client::datadogV2::model::LLMObsIntegrationName;
use datadog_api_client::datadogV2::model::LLMObsOpenAIMetadata;
use datadog_api_client::datadogV2::model::LLMObsOpenAIReasoningEffort;
use datadog_api_client::datadogV2::model::LLMObsOpenAIReasoningSummary;
use datadog_api_client::datadogV2::model::LLMObsVertexAIMetadata;
use serde_json::Value;
use std::collections::BTreeMap;

#[tokio::main]
async fn main() {
let body = LLMObsIntegrationInferenceRequest::new(
vec![LLMObsInferenceMessage::new()
.content("What is the capital of France?".to_string())
.contents(vec![LLMObsInferenceContent::new(
"text".to_string(),
LLMObsInferenceContentValue::new()
.text("Hello, how can I help you?".to_string())
.tool_call(
LLMObsInferenceToolCall::new()
.arguments(BTreeMap::from([(
"location".to_string(),
Value::from("San Francisco"),
)]))
.name("get_weather".to_string())
.tool_id("call_abc123".to_string())
.type_("function".to_string()),
)
.tool_call_result(
LLMObsInferenceToolResult::new()
.name("get_weather".to_string())
.result("The weather in San Francisco is 68°F and sunny.".to_string())
.tool_id("call_abc123".to_string())
.type_("function".to_string()),
),
)])
.id("msg_001".to_string())
.role("user".to_string())
.tool_calls(vec![LLMObsInferenceToolCall::new()
.arguments(BTreeMap::from([(
"location".to_string(),
Value::from("San Francisco"),
)]))
.name("get_weather".to_string())
.tool_id("call_abc123".to_string())
.type_("function".to_string())])
.tool_results(vec![LLMObsInferenceToolResult::new()
.name("get_weather".to_string())
.result("The weather in San Francisco is 68°F and sunny.".to_string())
.tool_id("call_abc123".to_string())
.type_("function".to_string())])],
"gpt-4o".to_string(),
)
.anthropic_metadata(
LLMObsAnthropicMetadata::new()
.effort(Some(LLMObsAnthropicEffort::MEDIUM))
.thinking(
LLMObsAnthropicThinkingConfig::new(LLMObsAnthropicThinkingType::ENABLED)
.budget_tokens(Some(1024)),
),
)
.azure_openai_metadata(
LLMObsAzureOpenAIMetadata::new()
.deployment_id("my-gpt4-deployment".to_string())
.model_version("0613".to_string())
.resource_name("my-azure-resource".to_string()),
)
.bedrock_metadata(LLMObsBedrockMetadata::new().region("us-east-1".to_string()))
.frequency_penalty(Some(0.0 as f64))
.json_schema(Some(
r#"{"type":"object","properties":{"answer":{"type":"string"}}}"#.to_string(),
))
.max_completion_tokens(Some(1024))
.max_tokens(Some(1024))
.openai_metadata(
LLMObsOpenAIMetadata::new()
.reasoning_effort(Some(LLMObsOpenAIReasoningEffort::MEDIUM))
.reasoning_summary(Some(LLMObsOpenAIReasoningSummary::AUTO)),
)
.presence_penalty(Some(0.0 as f64))
.temperature(Some(0.7 as f64))
.tools(vec![LLMObsInferenceTool::new(
LLMObsInferenceFunction::new(
"get_weather".to_string(),
BTreeMap::from([("type".to_string(), Value::from("object"))]),
)
.description("Get the current weather for a location.".to_string()),
"function".to_string(),
)])
.top_k(Some(50))
.top_p(Some(1.0 as f64))
.vertex_ai_metadata(
LLMObsVertexAIMetadata::new()
.location("us-central1".to_string())
.project("my-gcp-project".to_string())
.project_ids(vec!["my-gcp-project".to_string()]),
);
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.CreateLLMObsIntegrationInference", true);
let api = LLMObservabilityAPI::with_config(configuration);
let resp = api
.create_llm_obs_integration_inference(
LLMObsIntegrationName::OPENAI,
"account_id".to_string(),
body,
)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
19 changes: 19 additions & 0 deletions examples/v2_llm-observability_ListLLMObsIntegrationAccounts.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// List LLM integration accounts returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_llm_observability::LLMObservabilityAPI;
use datadog_api_client::datadogV2::model::LLMObsIntegrationName;

#[tokio::main]
async fn main() {
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.ListLLMObsIntegrationAccounts", true);
let api = LLMObservabilityAPI::with_config(configuration);
let resp = api
.list_llm_obs_integration_accounts(LLMObsIntegrationName::OPENAI)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
19 changes: 19 additions & 0 deletions examples/v2_llm-observability_ListLLMObsIntegrationModels.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// List LLM integration models returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_llm_observability::LLMObservabilityAPI;
use datadog_api_client::datadogV2::model::LLMObsIntegrationName;

#[tokio::main]
async fn main() {
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.ListLLMObsIntegrationModels", true);
let api = LLMObservabilityAPI::with_config(configuration);
let resp = api
.list_llm_obs_integration_models(LLMObsIntegrationName::OPENAI, "account_id".to_string())
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
3 changes: 3 additions & 0 deletions src/datadog/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ impl Default for Configuration {
("v2.create_llm_obs_dataset_records".to_owned(), false),
("v2.create_llm_obs_experiment".to_owned(), false),
("v2.create_llm_obs_experiment_events".to_owned(), false),
("v2.create_llm_obs_integration_inference".to_owned(), false),
("v2.create_llm_obs_project".to_owned(), false),
("v2.delete_llm_obs_annotation_queue".to_owned(), false),
(
Expand All @@ -173,6 +174,8 @@ impl Default for Configuration {
("v2.list_llm_obs_datasets".to_owned(), false),
("v2.list_llm_obs_experiment_events".to_owned(), false),
("v2.list_llm_obs_experiments".to_owned(), false),
("v2.list_llm_obs_integration_accounts".to_owned(), false),
("v2.list_llm_obs_integration_models".to_owned(), false),
("v2.list_llm_obs_projects".to_owned(), false),
("v2.list_llm_obs_spans".to_owned(), false),
("v2.search_llm_obs_experimentation".to_owned(), false),
Expand Down
Loading
Loading