Skip to content
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

feat(semcov): add metadata #179

Merged
merged 4 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 5 additions & 0 deletions js/.changeset/cuddly-shoes-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@arizeai/openinference-semantic-conventions": minor
---

Add metadata semantic conventions
mikeldking marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export const SemanticAttributePrefixes = {
embedding: "embedding",
tool: "tool",
tool_call: "tool_call",
metadata: "metadata",
tags: "tags",
openinference: "openinference",
} as const;

Expand Down Expand Up @@ -78,6 +80,10 @@ export const DocumentAttributePostfixes = {
metadata: "metadata",
} as const;

export const TagAttributePostfixes = {
tags: "tags",
} as const;

/**
* The input to any span
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,17 @@ class SpanAttributes:

RETRIEVAL_DOCUMENTS = "retrieval.documents"

METADATA = "metadata"
"""
Metadata attributes are used to store user-defined key-value pairs.
For example, LangChain uses metadata to store user-defined attributes for a chain.
"""

TAGS = "tags.tags"
RogerHYang marked this conversation as resolved.
Show resolved Hide resolved
"""
Custom categorical tags for the span.
"""

OPENINFERENCE_SPAN_KIND = "openinference.span.kind"


Expand Down
4 changes: 3 additions & 1 deletion spec/semantic_conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ operations used by applications. These conventions are used to populate the `att
The following attributes are reserved and MUST be supported by all OpenInference Tracing SDKs:

| Attribute | Type | Example | Description |
|----------------------------------------|-----------------|----------------------------------------------------------------------------|------------------------------------------------------------------|
| -------------------------------------- | --------------- | -------------------------------------------------------------------------- | ---------------------------------------------------------------- |
| `openinference.span.kind` | String | `"CHAIN"` | The kind of span (e.g., `CHAIN`, `LLM`, `RETRIEVER`, `RERANKER`) |
| `exception.type` | String | `"NullPointerException"` | The type of exception that was thrown |
| `exception.message` | String | `"Null value encountered"` | Detailed message describing the exception |
Expand Down Expand Up @@ -53,5 +53,7 @@ The following attributes are reserved and MUST be supported by all OpenInference
| `reranker.query` | String | `"How to format timestamp?"` | Query parameter of the reranker |
| `reranker.model_name` | String | `"cross-encoder/ms-marco-MiniLM-L-12-v2"` | Model name of the reranker |
| `reranker.top_k` | Integer | 3 | Top K parameter of the reranker |
| `tag.tags` | List of strings | ["shopping", "travel"] | List of tags to give the span a category |
| `metadata.*` | Any | Any OTEL-compatible value | User-defined metadata for a chain or other span kind |

Note: the `object` type refers to a set of key-value pairs also known as a `struct`, `mapping`, `dictionary`, etc.
Loading