Same agent Smaller bill. The tools and infrastructure to get more work from your AI. Fewer tokens. Less compute. Lower cost.
TypeScript agent-harnessagent-harness-engineeringai-engineeringai-observabilityamd-gpuclaude-codeclickhousecodexcoding-agentcoding-agentscursorgenaigpu-monitoringllm-observabilityllmopsnvidia-smiobservabilityopen-sourceopenaiopentelemetry
[Fix]: Typo GEN_AI_RESPONSE_IMAGE_ in SemanticConvetion (#295)
Cherish 蔡梦缘c260fddedfb0
diff --git a/docs/latest/features/tracing.mdx b/docs/latest/features/tracing.mdxindex c8f32063..1a125e5b 100644--- a/docs/latest/features/tracing.mdx+++ b/docs/latest/features/tracing.mdx@@ -183,6 +183,9 @@ These attributes detail the specifics of requests sent to LLMs, including config| `gen_ai.request.fine_tune_batch_size` | int | Batch size used in the finetuning process. | `16` || `gen_ai.request.validation_file` | string | Location or type of validation file used in the training process. | `val_data.json` || `gen_ai.request.training_file` | string | Location or type of training file used for the LLM. | `train_data.json` |+| `gen_ai.request.image_size` | string | Size specifications for the generated image. | `1024x768` |+| `gen_ai.request.image_quality` | int | Quality parameter for the generated image, usually a percentage. | `90` |+| `gen_ai.request.image_style` | string | Style or theme of the generated image. | `van_gogh` |#### Response Attributes@@ -193,9 +196,6 @@ Attributes in this category help trace and understand responses from LLMs, encap| `gen_ai.response.id` | string | The unique identifier for the response. | `resp-456` || `gen_ai.response.finish_reasons` | string | Reasons the model stopped generating tokens. | `stop` || `gen_ai.response.image` | string | The image content generated by the LLM. | `<image URL or base64 string>` |-| `gen_ai.response.image_size` | string | Size specifications for the generated image. | `1024x768` |-| `gen_ai.response.image_quality` | int | Quality parameter for the generated image, usually a percentage. | `90` |-| `gen_ai.response.image_style` | string | Style or theme of the generated image. | `van_gogh` |#### Usage Attributesdiff --git a/sdk/python/src/openlit/instrumentation/bedrock/bedrock.py b/sdk/python/src/openlit/instrumentation/bedrock/bedrock.pyindex ee2005e3..d7e1fc2d 100644--- a/sdk/python/src/openlit/instrumentation/bedrock/bedrock.py+++ b/sdk/python/src/openlit/instrumentation/bedrock/bedrock.py@@ -88,9 +88,9 @@ def chat(gen_ai_endpoint, version, environment, application_name, tracer,quality = request_body.get("imageGenerationConfig", {}).get("quality", "standard")n = request_body.get("imageGenerationConfig", {}).get("numberOfImages", 1)- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_IMAGE_SIZE,+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IMAGE_SIZE,size)- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_IMAGE_QUALITY,+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IMAGE_QUALITY,quality)# Calculate cost of the operationcost = n * get_image_model_cost(model,diff --git a/sdk/python/src/openlit/instrumentation/openai/async_azure_openai.py b/sdk/python/src/openlit/instrumentation/openai/async_azure_openai.pyindex 3f770472..0f903aa4 100644--- a/sdk/python/src/openlit/instrumentation/openai/async_azure_openai.py+++ b/sdk/python/src/openlit/instrumentation/openai/async_azure_openai.py@@ -785,11 +785,11 @@ def azure_async_image_generate(gen_ai_endpoint, version, environment, applicatioapplication_name)span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,"azure_" + kwargs.get("model", "dall-e-3"))- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_IMAGE_SIZE,+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IMAGE_SIZE,kwargs.get("size", "1024x1024"))- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_IMAGE_QUALITY,+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IMAGE_QUALITY,kwargs.get("quality", "standard"))- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_IMAGE_STYLE,+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IMAGE_STYLE,kwargs.get("style", "vivid"))span.set_attribute(SemanticConvetion.GEN_AI_CONTENT_REVISED_PROMPT,items.revised_prompt if response.revised_prompt else "")diff --git a/sdk/python/src/openlit/instrumentation/openai/async_openai.py b/sdk/python/src/openlit/instrumentation/openai/async_openai.pyindex b870e059..0bc46de1 100644--- a/sdk/python/src/openlit/instrumentation/openai/async_openai.py+++ b/sdk/python/src/openlit/instrumentation/openai/async_openai.py@@ -600,11 +600,11 @@ def async_image_generate(gen_ai_endpoint, version, environment, application_nameapplication_name)span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,kwargs.get("model", "dall-e-2"))- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_IMAGE_SIZE,+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IMAGE_SIZE,kwargs.get("size", "1024x1024"))- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_IMAGE_QUALITY,+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IMAGE_QUALITY,kwargs.get("quality", "standard"))- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_IMAGE_STYLE,+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IMAGE_STYLE,kwargs.get("style", "vivid"))span.set_attribute(SemanticConvetion.GEN_AI_CONTENT_REVISED_PROMPT,items.revised_prompt if items.revised_prompt else "")@@ -724,9 +724,9 @@ def async_image_variatons(gen_ai_endpoint, version, environment, application_namkwargs.get("model", "dall-e-2"))span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_USER,kwargs.get("user", ""))- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_IMAGE_SIZE,+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IMAGE_SIZE,kwargs.get("size", "1024x1024"))- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_IMAGE_QUALITY,+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IMAGE_QUALITY,"standard")if trace_content:span.set_attribute(SemanticConvetion.GEN_AI_CONTENT_PROMPT,diff --git a/sdk/python/src/openlit/instrumentation/openai/azure_openai.py b/sdk/python/src/openlit/instrumentation/openai/azure_openai.pyindex 12b7e391..b15ad9ea 100644--- a/sdk/python/src/openlit/instrumentation/openai/azure_openai.py+++ b/sdk/python/src/openlit/instrumentation/openai/azure_openai.py@@ -784,11 +784,11 @@ def azure_image_generate(gen_ai_endpoint, version, environment, application_nameapplication_name)span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,"azure_" + kwargs.get("model", "dall-e-3"))- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_IMAGE_SIZE,+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IMAGE_SIZE,kwargs.get("size", "1024x1024"))- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_IMAGE_QUALITY,+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IMAGE_QUALITY,kwargs.get("quality", "standard"))- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_IMAGE_STYLE,+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IMAGE_STYLE,kwargs.get("style", "vivid"))span.set_attribute(SemanticConvetion.GEN_AI_CONTENT_REVISED_PROMPT,items.revised_prompt if response.revised_prompt else "")diff --git a/sdk/python/src/openlit/instrumentation/openai/openai.py b/sdk/python/src/openlit/instrumentation/openai/openai.pyindex 42b55a66..69e03706 100644--- a/sdk/python/src/openlit/instrumentation/openai/openai.py+++ b/sdk/python/src/openlit/instrumentation/openai/openai.py@@ -615,11 +615,11 @@ def image_generate(gen_ai_endpoint, version, environment, application_name,application_name)span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_MODEL,kwargs.get("model", "dall-e-2"))- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_IMAGE_SIZE,+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IMAGE_SIZE,kwargs.get("size", "1024x1024"))- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_IMAGE_QUALITY,+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IMAGE_QUALITY,kwargs.get("quality", "standard"))- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_IMAGE_STYLE,+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IMAGE_STYLE,kwargs.get("style", "vivid"))span.set_attribute(SemanticConvetion.GEN_AI_CONTENT_REVISED_PROMPT,items.revised_prompt if items.revised_prompt else "")@@ -739,9 +739,9 @@ def image_variatons(gen_ai_endpoint, version, environment, application_name,kwargs.get("model", "dall-e-2"))span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_USER,kwargs.get("user", ""))- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_IMAGE_SIZE,+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IMAGE_SIZE,kwargs.get("size", "1024x1024"))- span.set_attribute(SemanticConvetion.GEN_AI_RESPONSE_IMAGE_QUALITY,+ span.set_attribute(SemanticConvetion.GEN_AI_REQUEST_IMAGE_QUALITY,"standard")if trace_content:span.set_attribute(SemanticConvetion.GEN_AI_CONTENT_PROMPT,diff --git a/sdk/python/src/openlit/semcov/__init__.py b/sdk/python/src/openlit/semcov/__init__.pyindex e9958802..683fc012 100644--- a/sdk/python/src/openlit/semcov/__init__.py+++ b/sdk/python/src/openlit/semcov/__init__.py@@ -53,6 +53,10 @@ class SemanticConvetion:GEN_AI_REQUEST_VALIDATION_FILE = "gen_ai.request.validation_file"GEN_AI_REQUEST_TRAINING_FILE = "gen_ai.request.training_file"+ GEN_AI_REQUEST_IMAGE_SIZE = "gen_ai.request.image_size"+ GEN_AI_REQUEST_IMAGE_QUALITY = "gen_ai.request.image_quality"+ GEN_AI_REQUEST_IMAGE_STYLE = "gen_ai.request.image_style"+# GenAI UsageGEN_AI_USAGE_PROMPT_TOKENS = "gen_ai.usage.prompt_tokens"GEN_AI_USAGE_COMPLETION_TOKENS = "gen_ai.usage.completion_tokens"@@ -63,9 +67,6 @@ class SemanticConvetion:GEN_AI_RESPONSE_ID = "gen_ai.response.id"GEN_AI_RESPONSE_FINISH_REASON = "gen_ai.response.finish_reason"GEN_AI_RESPONSE_IMAGE = "gen_ai.response.image" # Not used directly in code yet- GEN_AI_RESPONSE_IMAGE_SIZE = "gen_ai.request.image_size"- GEN_AI_RESPONSE_IMAGE_QUALITY = "gen_ai.request.image_quality"- GEN_AI_RESPONSE_IMAGE_STYLE = "gen_ai.request.image_style"# GenAI ContentGEN_AI_CONTENT_PROMPT = "gen_ai.prompt"