mirror of
https://github.com/github/awesome-copilot.git
synced 2026-05-04 22:25:57 +00:00
chore: sync Arize skills from arize-skills@597d609bfe5f07fd7d24acfdb408a082911b18fc and phoenix@746247cbb07b0dc7803b87c69dd8c77811c33f59 (#1583)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
24
skills/phoenix-tracing/README.md
Normal file
24
skills/phoenix-tracing/README.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# Phoenix Tracing Skill
|
||||
|
||||
OpenInference semantic conventions and instrumentation guides for Phoenix.
|
||||
|
||||
## Usage
|
||||
|
||||
Start with `SKILL.md` for the index and quick reference.
|
||||
|
||||
## File Organization
|
||||
|
||||
All files in flat `rules/` directory with semantic prefixes:
|
||||
|
||||
- `span-*` - Span kinds (LLM, CHAIN, TOOL, etc.)
|
||||
- `setup-*`, `instrumentation-*` - Getting started guides
|
||||
- `fundamentals-*`, `attributes-*` - Reference docs
|
||||
- `annotations-*`, `export-*` - Advanced features
|
||||
|
||||
## Reference
|
||||
|
||||
- [OpenInference Spec](https://github.com/Arize-ai/openinference/tree/main/spec)
|
||||
- [Phoenix Documentation](https://docs.arize.com/phoenix)
|
||||
- [Python OTEL API](https://arize-phoenix.readthedocs.io/projects/otel/en/latest/)
|
||||
- [Python Client API](https://arize-phoenix.readthedocs.io/projects/client/en/latest/)
|
||||
- [TypeScript API](https://arize-ai.github.io/phoenix/)
|
||||
@@ -55,6 +55,19 @@ client.traces.add_trace_annotation(
|
||||
)
|
||||
```
|
||||
|
||||
## Span Notes
|
||||
|
||||
Notes are a special type of annotation for free-form text — useful for open coding, where reviewers leave qualitative observations on a span before any rubric exists. Later, those notes can be aggregated and distilled into structured labels or scores.
|
||||
|
||||
Notes are **append-only**: each call auto-generates a UUIDv4 identifier, so multiple notes naturally accumulate on the same span. Structured annotations are keyed by `(name, span_id, identifier)` — you can have many same-named annotations on one span by supplying distinct identifiers (e.g. one per reviewer); writing the same `(name, span_id, identifier)` overwrites the existing entry.
|
||||
|
||||
```python
|
||||
client.spans.add_span_note(
|
||||
span_id="abc123def456",
|
||||
note="Unexpected token in response, needs review",
|
||||
)
|
||||
```
|
||||
|
||||
## Session Annotations
|
||||
|
||||
Feedback on multi-turn conversations:
|
||||
|
||||
@@ -5,7 +5,7 @@ Add feedback to spans, traces, documents, and sessions using the TypeScript clie
|
||||
## Client Setup
|
||||
|
||||
```typescript
|
||||
import { createClient } from "phoenix-client";
|
||||
import { createClient } from "@arizeai/phoenix-client";
|
||||
const client = createClient(); // Default: http://localhost:6006
|
||||
```
|
||||
|
||||
@@ -14,7 +14,7 @@ const client = createClient(); // Default: http://localhost:6006
|
||||
Add feedback to individual spans:
|
||||
|
||||
```typescript
|
||||
import { addSpanAnnotation } from "phoenix-client";
|
||||
import { addSpanAnnotation } from "@arizeai/phoenix-client/spans";
|
||||
|
||||
await addSpanAnnotation({
|
||||
client,
|
||||
@@ -31,12 +31,30 @@ await addSpanAnnotation({
|
||||
});
|
||||
```
|
||||
|
||||
## Span Notes
|
||||
|
||||
Notes are a special type of annotation for free-form text — useful for open coding, where reviewers leave qualitative observations on a span before any rubric exists. Later, those notes can be aggregated and distilled into structured labels or scores.
|
||||
|
||||
Notes are **append-only**: each call auto-generates a UUIDv4 identifier, so multiple notes naturally accumulate on the same span. Structured annotations are keyed by `(name, spanId, identifier)` — you can have many same-named annotations on one span by supplying distinct identifiers (e.g. one per reviewer); writing the same `(name, spanId, identifier)` overwrites the existing entry.
|
||||
|
||||
```typescript
|
||||
import { addSpanNote } from "@arizeai/phoenix-client/spans";
|
||||
|
||||
await addSpanNote({
|
||||
client,
|
||||
spanNote: {
|
||||
spanId: "abc123",
|
||||
note: "This span shows unexpected behavior, needs review"
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Document Annotations
|
||||
|
||||
Rate individual documents in RETRIEVER spans:
|
||||
|
||||
```typescript
|
||||
import { addDocumentAnnotation } from "phoenix-client";
|
||||
import { addDocumentAnnotation } from "@arizeai/phoenix-client/spans";
|
||||
|
||||
await addDocumentAnnotation({
|
||||
client,
|
||||
@@ -56,7 +74,7 @@ await addDocumentAnnotation({
|
||||
Feedback on entire traces:
|
||||
|
||||
```typescript
|
||||
import { addTraceAnnotation } from "phoenix-client";
|
||||
import { addTraceAnnotation } from "@arizeai/phoenix-client/traces";
|
||||
|
||||
await addTraceAnnotation({
|
||||
client,
|
||||
@@ -70,12 +88,28 @@ await addTraceAnnotation({
|
||||
});
|
||||
```
|
||||
|
||||
## Trace Notes
|
||||
|
||||
Notes on entire traces (multiple notes allowed per trace):
|
||||
|
||||
```typescript
|
||||
import { addTraceNote } from "@arizeai/phoenix-client/traces";
|
||||
|
||||
await addTraceNote({
|
||||
client,
|
||||
traceNote: {
|
||||
traceId: "abc123def456",
|
||||
note: "Needs follow-up — unexpected tool call sequence"
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Session Annotations
|
||||
|
||||
Feedback on multi-turn conversations:
|
||||
|
||||
```typescript
|
||||
import { addSessionAnnotation } from "phoenix-client";
|
||||
import { addSessionAnnotation } from "@arizeai/phoenix-client/sessions";
|
||||
|
||||
await addSessionAnnotation({
|
||||
client,
|
||||
@@ -92,7 +126,9 @@ await addSessionAnnotation({
|
||||
## RAG Pipeline Example
|
||||
|
||||
```typescript
|
||||
import { createClient, logDocumentAnnotations, addSpanAnnotation, addTraceAnnotation } from "phoenix-client";
|
||||
import { createClient } from "@arizeai/phoenix-client";
|
||||
import { logDocumentAnnotations, addSpanAnnotation } from "@arizeai/phoenix-client/spans";
|
||||
import { addTraceAnnotation } from "@arizeai/phoenix-client/traces";
|
||||
|
||||
const client = createClient();
|
||||
|
||||
|
||||
@@ -5,13 +5,13 @@ Add custom attributes to spans for richer observability.
|
||||
## Install
|
||||
|
||||
```bash
|
||||
pip install openinference-instrumentation
|
||||
pip install arize-phoenix-otel # context managers and SpanAttributes re-exported since 0.16.0
|
||||
```
|
||||
|
||||
## Session
|
||||
|
||||
```python
|
||||
from openinference.instrumentation import using_session
|
||||
from phoenix.otel import using_session
|
||||
|
||||
with using_session(session_id="my-session-id"):
|
||||
# Spans get: "session.id" = "my-session-id"
|
||||
@@ -21,7 +21,7 @@ with using_session(session_id="my-session-id"):
|
||||
## User
|
||||
|
||||
```python
|
||||
from openinference.instrumentation import using_user
|
||||
from phoenix.otel import using_user
|
||||
|
||||
with using_user("my-user-id"):
|
||||
# Spans get: "user.id" = "my-user-id"
|
||||
@@ -31,7 +31,7 @@ with using_user("my-user-id"):
|
||||
## Metadata
|
||||
|
||||
```python
|
||||
from openinference.instrumentation import using_metadata
|
||||
from phoenix.otel import using_metadata
|
||||
|
||||
with using_metadata({"key": "value", "experiment_id": "exp_123"}):
|
||||
# Spans get: "metadata" = '{"key": "value", "experiment_id": "exp_123"}'
|
||||
@@ -41,7 +41,7 @@ with using_metadata({"key": "value", "experiment_id": "exp_123"}):
|
||||
## Tags
|
||||
|
||||
```python
|
||||
from openinference.instrumentation import using_tags
|
||||
from phoenix.otel import using_tags
|
||||
|
||||
with using_tags(["tag_1", "tag_2"]):
|
||||
# Spans get: "tag.tags" = '["tag_1", "tag_2"]'
|
||||
@@ -51,7 +51,7 @@ with using_tags(["tag_1", "tag_2"]):
|
||||
## Combined (using_attributes)
|
||||
|
||||
```python
|
||||
from openinference.instrumentation import using_attributes
|
||||
from phoenix.otel import using_attributes
|
||||
|
||||
with using_attributes(
|
||||
session_id="my-session-id",
|
||||
@@ -79,6 +79,8 @@ span.set_attribute("session.id", "session_456")
|
||||
All context managers can be used as decorators:
|
||||
|
||||
```python
|
||||
from phoenix.otel import using_session, using_user, using_metadata
|
||||
|
||||
@using_session(session_id="my-session-id")
|
||||
@using_user("my-user-id")
|
||||
@using_metadata({"env": "prod"})
|
||||
|
||||
@@ -5,7 +5,7 @@ Track multi-turn conversations by grouping traces with session IDs.
|
||||
## Setup
|
||||
|
||||
```python
|
||||
from openinference.instrumentation import using_session
|
||||
from phoenix.otel import using_session
|
||||
|
||||
with using_session(session_id="user_123_conv_456"):
|
||||
response = llm.invoke(prompt)
|
||||
@@ -16,7 +16,7 @@ with using_session(session_id="user_123_conv_456"):
|
||||
**Bad: Only parent span gets session ID**
|
||||
|
||||
```python
|
||||
from openinference.semconv.trace import SpanAttributes
|
||||
from phoenix.otel import SpanAttributes
|
||||
from opentelemetry import trace
|
||||
|
||||
span = trace.get_current_span()
|
||||
@@ -51,7 +51,7 @@ Bad: `"session_1"`, `"test"`, empty string
|
||||
|
||||
```python
|
||||
import uuid
|
||||
from openinference.instrumentation import using_session
|
||||
from phoenix.otel import using_session
|
||||
|
||||
session_id = str(uuid.uuid4())
|
||||
messages = []
|
||||
@@ -73,7 +73,7 @@ def send_message(user_input: str) -> str:
|
||||
## Additional Attributes
|
||||
|
||||
```python
|
||||
from openinference.instrumentation import using_attributes
|
||||
from phoenix.otel import using_attributes
|
||||
|
||||
with using_attributes(
|
||||
user_id="user_123",
|
||||
|
||||
Reference in New Issue
Block a user