From 5c6df3e783d6c5482a2a83862e9fcec6696088c0 Mon Sep 17 00:00:00 2001 From: Nir Gazit Date: Tue, 19 Mar 2024 15:55:06 +0200 Subject: [PATCH] fix: prompt/completion format --- docs/ai/llm-spans.md | 4 ++-- docs/attributes-registry/llm.md | 8 ++------ model/registry/llm.yaml | 8 ++++---- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/docs/ai/llm-spans.md b/docs/ai/llm-spans.md index 767bfc8ffb..9a58096ed0 100644 --- a/docs/ai/llm-spans.md +++ b/docs/ai/llm-spans.md @@ -65,7 +65,7 @@ The event name MUST be `gen_ai.llm.content.prompt`. | Attribute | Type | Description | Examples | Requirement Level | |---|---|---|---|---| -| [`gen_ai.llm.prompt`](../attributes-registry/llm.md) | string | The full prompt string sent to an LLM in a request. [1] | `\\n\\nHuman:You are an AI assistant that tells jokes. Can you tell me a joke about OpenTelemetry?\\n\\nAssistant:` | Recommended | +| [`gen_ai.llm.prompt`](../attributes-registry/llm.md) | string | The full prompt sent to an LLM, as a stringified JSON in OpenAI's format. [1] | `[{'role': 'user', 'content': 'What is the capital of France?'}]` | Recommended | **[1]:** The full prompt sent to an LLM in a request, structured as a JSON in OpenAI's format. @@ -75,7 +75,7 @@ The event name MUST be `gen_ai.llm.content.completion`. | Attribute | Type | Description | Examples | Requirement Level | |---|---|---|---|---| -| [`gen_ai.llm.completion`](../attributes-registry/llm.md) | string | The full response string from an LLM in a response. [1] | `Why did the developer stop using OpenTelemetry? Because they couldnt trace their steps!` | Recommended | +| [`gen_ai.llm.completion`](../attributes-registry/llm.md) | string | The full response received from the LLM, as a stringified JSON in OpenAI's format. [1] | `[{'role': 'assistant', 'content': 'The capital of France is Paris.'}]` | Recommended | **[1]:** The full response from an LLM, structured as a JSON in OpenAI's format. diff --git a/docs/attributes-registry/llm.md b/docs/attributes-registry/llm.md index e9d5d43cb8..ea77923dfb 100644 --- a/docs/attributes-registry/llm.md +++ b/docs/attributes-registry/llm.md @@ -9,10 +9,6 @@ * [Request Attributes](#request-attributes) * [Response Attributes](#response-attributes) * [Event Attributes](#event-attributes) -- [OpenAI Attributes](#openai-attributes) - * [Request Attributes](#request-attributes-1) - * [Response Attributes](#response-attributes-1) - * [Event Attributes](#event-attributes-1) @@ -47,6 +43,6 @@ | Attribute | Type | Description | Examples | |---|---|---|---| -| `gen_ai.llm.completion` | string | The full response string from an LLM in a response. | `Why did the developer stop using OpenTelemetry? Because they couldnt trace their steps!` | -| `gen_ai.llm.prompt` | string | The full prompt string sent to an LLM in a request. | `\\n\\nHuman:You are an AI assistant that tells jokes. Can you tell me a joke about OpenTelemetry?\\n\\nAssistant:` | +| `gen_ai.llm.completion` | string | The full response received from the LLM, as a stringified JSON in OpenAI's format. | `[{'role': 'assistant', 'content': 'The capital of France is Paris.'}]` | +| `gen_ai.llm.prompt` | string | The full prompt sent to an LLM, as a stringified JSON in OpenAI's format. | `[{'role': 'user', 'content': 'What is the capital of France?'}]` | \ No newline at end of file diff --git a/model/registry/llm.yaml b/model/registry/llm.yaml index 777d975827..e9708d5a85 100644 --- a/model/registry/llm.yaml +++ b/model/registry/llm.yaml @@ -57,11 +57,11 @@ groups: tag: llm-generic-response - id: prompt type: string - brief: The full prompt string sent to an LLM in a request. - examples: ['\\n\\nHuman:You are an AI assistant that tells jokes. Can you tell me a joke about OpenTelemetry?\\n\\nAssistant:'] + brief: The full prompt sent to an LLM, as a stringified JSON in OpenAI's format. + examples: ["[{'role': 'user', 'content': 'What is the capital of France?'}]"] tag: llm-generic-events - id: completion type: string - brief: The full response string from an LLM in a response. - examples: ['Why did the developer stop using OpenTelemetry? Because they couldnt trace their steps!'] + brief: The full response received from the LLM, as a stringified JSON in OpenAI's format. + examples: ["[{'role': 'assistant', 'content': 'The capital of France is Paris.'}]"] tag: llm-generic-events