-
Notifications
You must be signed in to change notification settings - Fork 268
Watsonx Semantic Conventions [INSTA-21674] #2792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
||
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. | ||
# The values here must be integers. | ||
issues: [123] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/123/1650
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ,
Added specific semantic conventions for IBM WatsonX AI including: | ||
- WatsonX-specific attributes like project_id, space_id, version, and trace_id | ||
- WatsonX-specific LLM attributes like decoding_method, random_seed, max_new_tokens, min_new_tokens, and repetition_penalty | ||
- WatsonX-specific metrics for completions duration, exceptions, responses, and tokens | ||
- Dedicated span definition for WatsonX client operations | ||
- Comprehensive documentation with examples |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may bring some confuse, can you remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done .
docs/attributes-registry/gen-ai.md
Outdated
|
||
## GenAI Attributes | ||
|
||
This document defines the attributes used to describe telemetry in the context of Generative Artificial Intelligence (GenAI) Models requests and responses. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This table is generated automatically, check https://github.com/open-telemetry/semantic-conventions/pull/2353/files and https://github.com/open-telemetry/semantic-conventions/blob/main/CONTRIBUTING.md#2-update-the-markdown-files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes I have executed table generation command and it created watsonx.md file under registry folder .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually the file should be deleted as it is replaced by registry/attributes/*.md which is auto generated.
model/gen-ai/watsonx.yaml
Outdated
brief: > | ||
This group defines attributes specific to IBM WatsonX AI. | ||
attributes: | ||
- id: gen_ai.watsonx.request.project_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/watsonx/watsonx.ai
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed
schema-next.yaml
Outdated
@@ -0,0 +1,586 @@ | |||
file_format: 1.1.0 | |||
schema_url: https://opentelemetry.io/schemas/next | |||
versions: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed the file .
@elinacse Please also check https://github.com/open-telemetry/semantic-conventions/pull/2046/files#diff-29d3a3c8df003e3fd7ac429797cf584e8faf546768432415a01c289802232aba Seems we need to follow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pr needs to be cleaned up to minimise unintended changes and removal of old auto generated files.
model/gen-ai/watsonx.yaml
Outdated
- id: metric.gen_ai.watsonx.ai.completions.duration | ||
type: metric | ||
metric_name: llm.watsonx.ai.completions.duration | ||
brief: 'Measures the duration of WatsonX completions operations' | ||
instrument: histogram | ||
unit: "s" | ||
stability: experimental | ||
extends: metric_attributes.gen_ai | ||
|
||
- id: metric.gen_ai.watsonx.ai.completions.exceptions | ||
type: metric | ||
metric_name: llm.watsonx.ai.completions.exceptions | ||
brief: 'Counts the number of exceptions that occurred during WatsonX completions operations' | ||
instrument: counter | ||
unit: "{exception}" | ||
stability: experimental | ||
extends: metric_attributes.gen_ai | ||
|
||
- id: metric.gen_ai.watsonx.ai.completions.responses | ||
type: metric | ||
metric_name: llm.watsonx.ai.completions.responses | ||
brief: 'Counts the number of responses received from WatsonX completions operations' | ||
instrument: counter | ||
unit: "{response}" | ||
stability: experimental | ||
extends: metric_attributes.gen_ai | ||
|
||
- id: metric.gen_ai.watsonx.ai.completions.tokens | ||
type: metric | ||
metric_name: llm.watsonx.ai.completions.tokens | ||
brief: 'Counts the number of tokens processed in WatsonX completions operations' | ||
instrument: counter | ||
unit: "{token}" | ||
stability: experimental | ||
extends: metric_attributes.gen_ai | ||
attributes: | ||
- ref: gen_ai.token.type | ||
requirement_level: required |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason these are being restricted to watsonx? Could we not have these as general gen-ai metrics?
model/gen-ai/watsonx.yaml
Outdated
- id: span.gen_ai.watsonx.ai.client | ||
stability: experimental | ||
span_kind: client | ||
type: span | ||
brief: > | ||
Describes an IBM WatsonX AI operation span. | ||
attributes: | ||
- ref: gen_ai.request.model | ||
requirement_level: required | ||
- ref: gen_ai.watsonx.ai.request.project_id | ||
requirement_level: | ||
conditionally_required: if the request includes a project_id | ||
- ref: gen_ai.watsonx.ai.request.space_id | ||
requirement_level: | ||
conditionally_required: if the request includes a space_id | ||
- ref: gen_ai.watsonx.ai.request.version | ||
requirement_level: recommended | ||
- ref: gen_ai.watsonx.ai.response.trace_id | ||
requirement_level: | ||
conditionally_required: if the response was received and includes a trace_id | ||
- ref: gen_ai.usage.input_tokens | ||
brief: The number of tokens used in the prompt sent to IBM WatsonX AI. | ||
- ref: gen_ai.usage.output_tokens | ||
brief: The number of tokens used in the completions from IBM WatsonX AI. | ||
- ref: llm.watsonx.ai.decoding_method | ||
requirement_level: recommended | ||
- ref: llm.watsonx.ai.random_seed | ||
requirement_level: recommended | ||
- ref: llm.watsonx.ai.max_new_tokens | ||
requirement_level: recommended | ||
- ref: llm.watsonx.ai.min_new_tokens | ||
requirement_level: recommended | ||
- ref: llm.watsonx.ai.repetition_penalty | ||
requirement_level: recommended |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be in the gen-ai/spans.yaml file
model/watsonxai/registry.yaml
Outdated
- id: watsonxai.request.version | ||
stability: development | ||
type: string | ||
brief: The version of the model being used. | ||
examples: ['1.0', '2.3.1'] | ||
- id: watsonxai.response.trace_id | ||
stability: development | ||
type: string | ||
brief: The trace ID returned by IBM WatsonX AI. | ||
examples: ['wxt-12345678-abcd-1234-efgh-1234567890ab'] | ||
- id: watsonxai.decoding_method | ||
stability: development | ||
type: string | ||
brief: The decoding method used by WatsonX for generating responses. | ||
examples: ['greedy', 'sample'] | ||
- id: watsonxai.random_seed | ||
stability: development | ||
type: int | ||
brief: The random seed used by WatsonX for deterministic generation. | ||
examples: [42] | ||
- id: watsonxai.max_new_tokens | ||
stability: development | ||
type: int | ||
brief: The maximum number of new tokens to generate in the response. | ||
examples: [100] | ||
- id: watsonxai.min_new_tokens | ||
stability: development | ||
type: int | ||
brief: The minimum number of new tokens to generate in the response. | ||
examples: [10] | ||
- id: watsonxai.repetition_penalty | ||
stability: development | ||
type: double | ||
brief: The penalty applied to repeated tokens in the generated response. | ||
examples: [1.2] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be reviewed to see if any existing attributes could be used, any new general attributes could be added.
docs/gen-ai/README.md
Outdated
* [Azure AI Inference](./azure-ai-inference.md): Semantic Conventions for Azure AI Inference. | ||
* [OpenAI](./openai.md): Semantic Conventions for OpenAI. | ||
* [AWS Bedrock](./aws-bedrock.md): Semantic Conventions for AWS Bedrock. | ||
* [IBM WatsonX AI](./watsonx.md): Semantic Conventions for IBM WatsonX AI. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/watsonx.md/ibm-watsonx-ai.md
docs/gen-ai/watsonx.md
Outdated
|
||
### IBM WatsonX AI Client | ||
|
||
**Span kind**: [Client](../../specification/trace/api.md#spankind) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You did not add following, how does this table is generated?
<!-- semconv new-group-id -->
<!-- endsemconv -->
model/gen-ai/watsonx.yaml
Outdated
@@ -0,0 +1,126 @@ | |||
groups: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we do not need this file
model/watsonxai/registry.yaml
Outdated
@@ -0,0 +1,53 @@ | |||
groups: | |||
- id: registry.watsonxai |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/registry.watsonxai/registry.ibm.watsonx.ai
model/watsonxai/registry.yaml
Outdated
brief: > | ||
This group defines attributes for IBM WatsonX AI. | ||
attributes: | ||
- id: watsonxai.request.project_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/watsonxai/ibm.watsonx.ai
docs/gen-ai/watsonx.md
Outdated
|
||
# IBM WatsonX AI | ||
|
||
**Status**: [Experimental](../document-status.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
**Status**: [Experimental](../document-status.md) | |
**Status**: [Development](https://opentelemetry.io/docs/specs/otel/document-status) |
docs/gen-ai/watsonx.md
Outdated
|
||
This document defines semantic conventions for IBM WatsonX AI. | ||
|
||
## Attributes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please take a look at other semantic conventions for GenAI, databases or messaging. We don't document attributes specific to that system, but the full conventions.
docs/gen-ai/watsonx.md
Outdated
| `gen_ai.watsonx.ai.request.version` | string | The version of the model being used | `1.0`, `2.3.1` | Recommended | | ||
| `gen_ai.watsonx.ai.response.trace_id` | string | The trace ID returned by IBM WatsonX AI | `wxt-12345678-abcd-1234-efgh-1234567890ab` | Conditionally Required [2] | | ||
| `llm.watsonx.ai.decoding_method` | string | The decoding method used by WatsonX for generating responses | `greedy`, `sample` | Recommended | | ||
| `llm.watsonx.ai.random_seed` | int | The random seed used by WatsonX for deterministic generation | `42` | Recommended | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
anything watson-specific should be in the ibm.watson*
namespace
docs/gen-ai/watsonx.md
Outdated
|
||
| Metric Name | Description | Unit | Instrument | Attribute Key | Attribute Values | Requirement Level | | ||
| --- | --- | --- | --- | --- | --- | --- | | ||
| `llm.watsonx.ai.completions.duration` | Measures the duration of WatsonX completions operations | s | Histogram | | | Recommended | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please unify this with generic GenAI metrics - they already capture everything you define here https://github.com/open-telemetry/semantic-conventions/blob/main/docs/gen-ai/gen-ai-metrics.md
docs/gen-ai/watsonx.md
Outdated
|
||
tracer = trace.get_tracer("example-watsonx-client") | ||
|
||
with tracer.start_as_current_span( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't usually add manual instrumentation code samples into semantic conventions.
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations | | ||
| -------- | --------------- | ----------- | -------------- | --------- | ------ | | ||
| `ibm.watsonx.ai.completions.tokens` | Counter | `{token}` | Number of tokens processed by IBM WatsonX.AI completions. |  | | | ||
|
||
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability | | ||
|---|---|---|---|---|---| | ||
| [`gen_ai.operation.name`](/docs/registry/attributes/gen-ai.md) | string | The name of the operation being performed. | `chat`; `text_completion` | `Required` |  | | ||
| [`gen_ai.token.type`](/docs/registry/attributes/gen-ai.md) | string | The type of token being counted. | `input`; `output` | `Required` |  | | ||
| [`gen_ai.request.model`](/docs/registry/attributes/gen-ai.md) | string | The name of the GenAI model a request is being made to. | `ibm/granite-13b-chat-v2` | `Recommended` |  | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this differ to the tables above?
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations | | ||
| -------- | --------------- | ----------- | -------------- | --------- | ------ | | ||
| `ibm.watsonx.ai.completions.responses` | Counter | `{response}` | Number of responses generated by IBM WatsonX.AI completions. |  | | | ||
|
||
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability | | ||
|---|---|---|---|---|---| | ||
| [`gen_ai.operation.name`](/docs/registry/attributes/gen-ai.md) | string | The name of the operation being performed. | `chat`; `text_completion` | `Required` |  | | ||
| [`gen_ai.request.model`](/docs/registry/attributes/gen-ai.md) | string | The name of the GenAI model a request is being made to. | `ibm/granite-13b-chat-v2` | `Recommended` |  | | ||
| [`gen_ai.response.finish_reasons`](/docs/registry/attributes/gen-ai.md) | string[] | Array of reasons the model stopped generating tokens. | `["stop"]`; `["length"]` | `Recommended` |  | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this differ to the tables above?
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations | | ||
| -------- | --------------- | ----------- | -------------- | --------- | ------ | | ||
| `ibm.watsonx.ai.completions.exceptions` | Counter | `{exception}` | Number of exceptions encountered during IBM WatsonX.AI completions. |  | | | ||
|
||
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability | | ||
|---|---|---|---|---|---| | ||
| [`gen_ai.operation.name`](/docs/registry/attributes/gen-ai.md) | string | The name of the operation being performed. | `chat`; `text_completion` | `Required` |  | | ||
| [`gen_ai.request.model`](/docs/registry/attributes/gen-ai.md) | string | The name of the GenAI model a request is being made to. | `ibm/granite-13b-chat-v2` | `Recommended` |  | | ||
| [`error.type`](/docs/registry/attributes/error.md) | string | Describes a class of error the operation ended with. | `timeout`; `rate_limit_exceeded`; `invalid_request` | `Required` |  | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this differ to the tables above?
- id: metric.ibm.watsonx.ai.completions.tokens | ||
type: metric | ||
metric_name: ibm.watsonx.ai.completions.tokens | ||
annotations: | ||
code_generation: | ||
metric_value_type: int | ||
brief: 'Number of tokens processed by IBM WatsonX.AI completions.' | ||
instrument: counter | ||
unit: "{token}" | ||
stability: development | ||
attributes: | ||
- ref: gen_ai.operation.name | ||
requirement_level: required | ||
- ref: gen_ai.token.type | ||
requirement_level: required | ||
- ref: gen_ai.request.model | ||
requirement_level: recommended |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we not be using gen_ai.client.token.usage?
Fixes #1650
Changes
Please provide a brief description of the changes here.
Note: if the PR is touching an area that is not listed in the existing areas, or the area does not have sufficient domain experts coverage, the PR might be tagged as experts needed and move slowly until experts are identified.
Merge requirement checklist
[chore]