From c4160088d3b6e208550aa944be20f3e2b45ad195 Mon Sep 17 00:00:00 2001 From: Rohit Kadhe Date: Fri, 21 Jun 2024 11:22:43 -0600 Subject: [PATCH 01/12] rename attributes to match otel conventions --- schemas/llm_span_attributes.json | 210 ++++++++++-------- .../models/llm_span_attributes.d.ts | 190 ++++++++++++---- .../schemas/llm_span_attributes.json | 210 ++++++++++-------- 3 files changed, 398 insertions(+), 212 deletions(-) diff --git a/schemas/llm_span_attributes.json b/schemas/llm_span_attributes.json index 2cce4d9..8c446b8 100644 --- a/schemas/llm_span_attributes.json +++ b/schemas/llm_span_attributes.json @@ -5,13 +5,16 @@ "additionalProperties": false, "properties": { "langtrace.service.name": { - "type": "string" + "type": "string", + "description": "Name of the service. Includes all supported service providers by langtrace" }, "langtrace.service.type": { - "type": "string" + "type": "string", + "description": "Type of the service. Allowed values: [llm, vectordb, framework]" }, "langtrace.service.version": { - "type": "string" + "type": "string", + "description": "Version of the service provider client" }, "langtrace.version": { "type": "string" @@ -20,121 +23,149 @@ "type": "string" }, "url.full": { - "type": "string" + "type": "string", + "description": "Full URL of the request" }, - "llm.api": { - "type": "string" + "url.path": { + "type": "string", + "description": "Path of the request" }, - "llm.model": { - "type": "string" + "gen_ai.request.model": { + "type": "string", + "description": "Model name from the input request" }, - "llm.temperature": { - "type": "number", - "format": "float" + "gen_ai.response.model": { + "type": "string", + "description": "Model name from the response" }, - "llm.top_p": { + "gen_ai.request.temperature": { "type": "number", - "format": "float" + "format": "float", + "description": "Temperature value from the input request" }, - "llm.top_k": { + "gen_ai.request.top_p": { "type": "number", - "format": "float" - }, - "llm.user": { - "type": "string" - }, - "llm.system.fingerprint": { - "type": "string" - }, - "llm.prompts": { - "type": "string" + "format": "float", + "description": "Top P value from the input request" }, - "llm.responses": { - "type": "string" - }, - "llm.token.counts": { - "type": "string" + "gen_ai.request.top_k": { + "type": "number", + "format": "float", + "description": "Top K results to return from the input request" }, - "llm.stream": { - "type": "boolean" + "gen_ai.user": { + "type": "string", + "description": "User ID from the input request" }, - "llm.encoding.formats": { - "type": "string" + "gen_ai.prompt": { + "type": "string", + "description": "Prompt text from the input request" }, - "llm.dimensions": { - "type": "string" + "gen_ai.completion": { + "type": "string", + "description": "Completion text from the response. This will be an array of json objects with the following format {\"role\": \"\", \"content\": \"\"}. Role can be one of the following values: [system, user, assistant, tool]" }, - "llm.generation_id": { - "type": "string" + "gen_ai.request.stream": { + "type": "boolean", + "description": "Stream flag from the input request" }, - "llm.response_id": { - "type": "string" + "gen_ai.request.encoding_formats": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Encoding formats from the input request. Allowed values: ['float', 'int8','uint8', 'binary', 'ubinary', 'base64']" }, - "llm.citations": { - "type": "string" + "gen_ai.request.dimensions": { + "type": "number", + "description": "Dimensions from the input request" }, - "llm.documents": { - "type": "string" + "gen_ai.response_id": { + "type": "string", + "description": "Response ID from the output response" }, - "llm.is_search_required": { - "type": "boolean" + "gen_ai.response.finish_reasons": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Array of reasons the model stopped generating tokens, corresponding to each generation received" }, - "llm.search_results": { - "type": "string" + "gen_ai.system_fingerprint": { + "type": "string", + "description": "System fingerprint of the system that generated the response" }, - "llm.tool_calls": { - "type": "string" + "gen_ai.request.documents": { + "type": "string", + "description": "Array of documents from the input request json stringified" }, - "llm.max_tokens": { - "type": "string" + "gen_ai.request.is_search_required": { + "type": "boolean", + "description": "Search flag from the input request" }, - "llm.max_input_tokens": { - "type": "string" + "gen_ai.response.tool_calls": { + "type": "string", + "description": "Array of tool calls from the response json stringified" }, - "llm.conversation_id": { - "type": "string" + "gen_ai.request.max_tokens": { + "type": "number", + "description": "The maximum number of tokens the LLM generates for a request." }, - "llm.seed": { - "type": "string" + "gen_ai.usage.prompt_tokens": { + "type": "number", + "description": "The number of tokens used in the llm prompt." }, - "llm.frequency_penalty": { - "type": "string" + "gen_ai.usage.completion_tokens": { + "type": "number", + "description": "The number of tokens in the llm response." }, - "llm.presence_penalty": { - "type": "string" + "gen_ai.request.seed": { + "type": "string", + "description": "Seed from the input request" }, - "llm.connectors": { - "type": "string" + "gen_ai.request.frequency_penalty": { + "type": "number", + "description": "Frequency penalty from the input request" }, - "llm.tools": { - "type": "string" + "gen_ai.request.presence_penalty": { + "type": "number", + "description": "Presence penalty from the input request" }, - "llm.tool_results": { - "type": "string" + "gen_ai.request.connectors": { + "type": "string", + "description": "An array of connectors from the input request json stringified" }, - "llm.embedding_inputs": { - "type": "string" + "gen_ai.request.tools": { + "type": "string", + "description": "An array of tools from the input request json stringified" }, - "llm.embedding_dataset_id": { - "type": "string" + "gen_ai.request.tool_results": { + "type": "string", + "description": "An array of tool results from the input request json stringified" }, - "llm.embedding_input_type": { - "type": "string" + "gen_ai.request.embedding_inputs": { + "type": "string", + "description": "An array of embedding inputs from the input request json stringified" }, - "llm.embedding_job_name": { - "type": "string" + "gen_ai.request.embedding_dataset_id": { + "type": "string", + "description": "Embedding dataset ID from the input request" }, - "llm.retrieval.query": { - "type": "string" + "gen_ai.request.embedding_input_type": { + "type": "string", + "description": "Embedding input type from the input request. Allowed values: [ 'search_document', 'search_query', 'classification', 'clustering']" }, - "llm.retrieval.results": { - "type": "string" + "gen_ai.request.embedding_job_name": { + "type": "string", + "description": "Embedding job name from the input request" }, - "llm.image.size": { - "type": "string" + "gen_ai.image.size": { + "type": "string", + "description": "Image size from the input request. Allowed values: ['256x256', '512x512', '1024x1024']" }, - "llm.response_format": { - "type": "string" + "gen_ai.response_format": { + "type": "string", + "description": "Response format from the input request. Allowed values: ['url', 'b64_json']" }, "http.max.retries": { "type": "integer", @@ -144,8 +175,13 @@ "type": "integer", "format": "int64" }, - "langtrace.testId": { - "type": "string" + "gen_ai.cohere.rerank.query": { + "type": "string", + "description": "Query from the input request for the rerank api" + }, + "gen_ai.cohere.rerank.results": { + "type": "string", + "description": "Results from the rerank api" } }, "required": [ @@ -154,6 +190,6 @@ "langtrace.sdk.name", "langtrace.version", "url.full", - "llm.api" + "gen_ai.api" ] -} +} \ No newline at end of file diff --git a/src/typescript/models/llm_span_attributes.d.ts b/src/typescript/models/llm_span_attributes.d.ts index c062a9e..f9d41d4 100644 --- a/src/typescript/models/llm_span_attributes.d.ts +++ b/src/typescript/models/llm_span_attributes.d.ts @@ -6,50 +6,164 @@ */ export interface LLMSpanAttributes { + /** + * Name of the service. Includes all supported service providers by langtrace + */ "langtrace.service.name": string; + /** + * Type of the service. Allowed values: [llm, vectordb, framework] + */ "langtrace.service.type": string; + /** + * Version of the service provider client + */ "langtrace.service.version"?: string; "langtrace.version": string; "langtrace.sdk.name": string; + /** + * Full URL of the request + */ "url.full": string; - "llm.api": string; - "llm.model"?: string; - "llm.temperature"?: number; - "llm.top_p"?: number; - "llm.top_k"?: number; - "llm.user"?: string; - "llm.system.fingerprint"?: string; - "llm.prompts"?: string; - "llm.responses"?: string; - "llm.token.counts"?: string; - "llm.stream"?: boolean; - "llm.encoding.formats"?: string; - "llm.dimensions"?: string; - "llm.generation_id"?: string; - "llm.response_id"?: string; - "llm.citations"?: string; - "llm.documents"?: string; - "llm.is_search_required"?: boolean; - "llm.search_results"?: string; - "llm.tool_calls"?: string; - "llm.max_tokens"?: string; - "llm.max_input_tokens"?: string; - "llm.conversation_id"?: string; - "llm.seed"?: string; - "llm.frequency_penalty"?: string; - "llm.presence_penalty"?: string; - "llm.connectors"?: string; - "llm.tools"?: string; - "llm.tool_results"?: string; - "llm.embedding_inputs"?: string; - "llm.embedding_dataset_id"?: string; - "llm.embedding_input_type"?: string; - "llm.embedding_job_name"?: string; - "llm.retrieval.query"?: string; - "llm.retrieval.results"?: string; - "llm.image.size"?: string; - "llm.response_format"?: string; + /** + * Path of the request + */ + "url.path"?: string; + /** + * Model name from the input request + */ + "gen_ai.request.model"?: string; + /** + * Model name from the response + */ + "gen_ai.response.model"?: string; + /** + * Temperature value from the input request + */ + "gen_ai.request.temperature"?: number; + /** + * Top P value from the input request + */ + "gen_ai.request.top_p"?: number; + /** + * Top K results to return from the input request + */ + "gen_ai.request.top_k"?: number; + /** + * User ID from the input request + */ + "gen_ai.user"?: string; + /** + * Prompt text from the input request + */ + "gen_ai.prompt"?: string; + /** + * Completion text from the response. This will be an array of json objects with the following format {"role": "", "content": ""}. Role can be one of the following values: [system, user, assistant, tool] + */ + "gen_ai.completion"?: string; + /** + * Stream flag from the input request + */ + "gen_ai.request.stream"?: boolean; + /** + * Encoding formats from the input request. Allowed values: ['float', 'int8','uint8', 'binary', 'ubinary', 'base64'] + */ + "gen_ai.request.encoding_formats"?: string[]; + /** + * Dimensions from the input request + */ + "gen_ai.request.dimensions"?: number; + /** + * Response ID from the output response + */ + "gen_ai.response_id"?: string; + /** + * Array of reasons the model stopped generating tokens, corresponding to each generation received + */ + "gen_ai.response.finish_reasons"?: string[]; + /** + * System fingerprint of the system that generated the response + */ + "gen_ai.system_fingerprint"?: string; + /** + * Array of documents from the input request json stringified + */ + "gen_ai.request.documents"?: string; + /** + * Search flag from the input request + */ + "gen_ai.request.is_search_required"?: boolean; + /** + * Array of tool calls from the response json stringified + */ + "gen_ai.response.tool_calls"?: string; + /** + * The maximum number of tokens the LLM generates for a request. + */ + "gen_ai.request.max_tokens"?: number; + /** + * The number of tokens used in the llm prompt. + */ + "gen_ai.usage.prompt_tokens"?: number; + /** + * The number of tokens in the llm response. + */ + "gen_ai.usage.completion_tokens"?: number; + /** + * Seed from the input request + */ + "gen_ai.request.seed"?: string; + /** + * Frequency penalty from the input request + */ + "gen_ai.request.frequency_penalty"?: number; + /** + * Presence penalty from the input request + */ + "gen_ai.request.presence_penalty"?: number; + /** + * An array of connectors from the input request json stringified + */ + "gen_ai.request.connectors"?: string; + /** + * An array of tools from the input request json stringified + */ + "gen_ai.request.tools"?: string; + /** + * An array of tool results from the input request json stringified + */ + "gen_ai.request.tool_results"?: string; + /** + * An array of embedding inputs from the input request json stringified + */ + "gen_ai.request.embedding_inputs"?: string; + /** + * Embedding dataset ID from the input request + */ + "gen_ai.request.embedding_dataset_id"?: string; + /** + * Embedding input type from the input request. Allowed values: [ 'search_document', 'search_query', 'classification', 'clustering'] + */ + "gen_ai.request.embedding_input_type"?: string; + /** + * Embedding job name from the input request + */ + "gen_ai.request.embedding_job_name"?: string; + /** + * Image size from the input request. Allowed values: ['256x256', '512x512', '1024x1024'] + */ + "gen_ai.image.size"?: string; + /** + * Response format from the input request. Allowed values: ['url', 'b64_json'] + */ + "gen_ai.response_format"?: string; "http.max.retries"?: number; "http.timeout"?: number; - "langtrace.testId"?: string; + /** + * Query from the input request for the rerank api + */ + "gen_ai.cohere.rerank.query"?: string; + /** + * Results from the rerank api + */ + "gen_ai.cohere.rerank.results"?: string; } diff --git a/src/typescript/schemas/llm_span_attributes.json b/src/typescript/schemas/llm_span_attributes.json index 2cce4d9..8c446b8 100644 --- a/src/typescript/schemas/llm_span_attributes.json +++ b/src/typescript/schemas/llm_span_attributes.json @@ -5,13 +5,16 @@ "additionalProperties": false, "properties": { "langtrace.service.name": { - "type": "string" + "type": "string", + "description": "Name of the service. Includes all supported service providers by langtrace" }, "langtrace.service.type": { - "type": "string" + "type": "string", + "description": "Type of the service. Allowed values: [llm, vectordb, framework]" }, "langtrace.service.version": { - "type": "string" + "type": "string", + "description": "Version of the service provider client" }, "langtrace.version": { "type": "string" @@ -20,121 +23,149 @@ "type": "string" }, "url.full": { - "type": "string" + "type": "string", + "description": "Full URL of the request" }, - "llm.api": { - "type": "string" + "url.path": { + "type": "string", + "description": "Path of the request" }, - "llm.model": { - "type": "string" + "gen_ai.request.model": { + "type": "string", + "description": "Model name from the input request" }, - "llm.temperature": { - "type": "number", - "format": "float" + "gen_ai.response.model": { + "type": "string", + "description": "Model name from the response" }, - "llm.top_p": { + "gen_ai.request.temperature": { "type": "number", - "format": "float" + "format": "float", + "description": "Temperature value from the input request" }, - "llm.top_k": { + "gen_ai.request.top_p": { "type": "number", - "format": "float" - }, - "llm.user": { - "type": "string" - }, - "llm.system.fingerprint": { - "type": "string" - }, - "llm.prompts": { - "type": "string" + "format": "float", + "description": "Top P value from the input request" }, - "llm.responses": { - "type": "string" - }, - "llm.token.counts": { - "type": "string" + "gen_ai.request.top_k": { + "type": "number", + "format": "float", + "description": "Top K results to return from the input request" }, - "llm.stream": { - "type": "boolean" + "gen_ai.user": { + "type": "string", + "description": "User ID from the input request" }, - "llm.encoding.formats": { - "type": "string" + "gen_ai.prompt": { + "type": "string", + "description": "Prompt text from the input request" }, - "llm.dimensions": { - "type": "string" + "gen_ai.completion": { + "type": "string", + "description": "Completion text from the response. This will be an array of json objects with the following format {\"role\": \"\", \"content\": \"\"}. Role can be one of the following values: [system, user, assistant, tool]" }, - "llm.generation_id": { - "type": "string" + "gen_ai.request.stream": { + "type": "boolean", + "description": "Stream flag from the input request" }, - "llm.response_id": { - "type": "string" + "gen_ai.request.encoding_formats": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Encoding formats from the input request. Allowed values: ['float', 'int8','uint8', 'binary', 'ubinary', 'base64']" }, - "llm.citations": { - "type": "string" + "gen_ai.request.dimensions": { + "type": "number", + "description": "Dimensions from the input request" }, - "llm.documents": { - "type": "string" + "gen_ai.response_id": { + "type": "string", + "description": "Response ID from the output response" }, - "llm.is_search_required": { - "type": "boolean" + "gen_ai.response.finish_reasons": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Array of reasons the model stopped generating tokens, corresponding to each generation received" }, - "llm.search_results": { - "type": "string" + "gen_ai.system_fingerprint": { + "type": "string", + "description": "System fingerprint of the system that generated the response" }, - "llm.tool_calls": { - "type": "string" + "gen_ai.request.documents": { + "type": "string", + "description": "Array of documents from the input request json stringified" }, - "llm.max_tokens": { - "type": "string" + "gen_ai.request.is_search_required": { + "type": "boolean", + "description": "Search flag from the input request" }, - "llm.max_input_tokens": { - "type": "string" + "gen_ai.response.tool_calls": { + "type": "string", + "description": "Array of tool calls from the response json stringified" }, - "llm.conversation_id": { - "type": "string" + "gen_ai.request.max_tokens": { + "type": "number", + "description": "The maximum number of tokens the LLM generates for a request." }, - "llm.seed": { - "type": "string" + "gen_ai.usage.prompt_tokens": { + "type": "number", + "description": "The number of tokens used in the llm prompt." }, - "llm.frequency_penalty": { - "type": "string" + "gen_ai.usage.completion_tokens": { + "type": "number", + "description": "The number of tokens in the llm response." }, - "llm.presence_penalty": { - "type": "string" + "gen_ai.request.seed": { + "type": "string", + "description": "Seed from the input request" }, - "llm.connectors": { - "type": "string" + "gen_ai.request.frequency_penalty": { + "type": "number", + "description": "Frequency penalty from the input request" }, - "llm.tools": { - "type": "string" + "gen_ai.request.presence_penalty": { + "type": "number", + "description": "Presence penalty from the input request" }, - "llm.tool_results": { - "type": "string" + "gen_ai.request.connectors": { + "type": "string", + "description": "An array of connectors from the input request json stringified" }, - "llm.embedding_inputs": { - "type": "string" + "gen_ai.request.tools": { + "type": "string", + "description": "An array of tools from the input request json stringified" }, - "llm.embedding_dataset_id": { - "type": "string" + "gen_ai.request.tool_results": { + "type": "string", + "description": "An array of tool results from the input request json stringified" }, - "llm.embedding_input_type": { - "type": "string" + "gen_ai.request.embedding_inputs": { + "type": "string", + "description": "An array of embedding inputs from the input request json stringified" }, - "llm.embedding_job_name": { - "type": "string" + "gen_ai.request.embedding_dataset_id": { + "type": "string", + "description": "Embedding dataset ID from the input request" }, - "llm.retrieval.query": { - "type": "string" + "gen_ai.request.embedding_input_type": { + "type": "string", + "description": "Embedding input type from the input request. Allowed values: [ 'search_document', 'search_query', 'classification', 'clustering']" }, - "llm.retrieval.results": { - "type": "string" + "gen_ai.request.embedding_job_name": { + "type": "string", + "description": "Embedding job name from the input request" }, - "llm.image.size": { - "type": "string" + "gen_ai.image.size": { + "type": "string", + "description": "Image size from the input request. Allowed values: ['256x256', '512x512', '1024x1024']" }, - "llm.response_format": { - "type": "string" + "gen_ai.response_format": { + "type": "string", + "description": "Response format from the input request. Allowed values: ['url', 'b64_json']" }, "http.max.retries": { "type": "integer", @@ -144,8 +175,13 @@ "type": "integer", "format": "int64" }, - "langtrace.testId": { - "type": "string" + "gen_ai.cohere.rerank.query": { + "type": "string", + "description": "Query from the input request for the rerank api" + }, + "gen_ai.cohere.rerank.results": { + "type": "string", + "description": "Results from the rerank api" } }, "required": [ @@ -154,6 +190,6 @@ "langtrace.sdk.name", "langtrace.version", "url.full", - "llm.api" + "gen_ai.api" ] -} +} \ No newline at end of file From a85350f58027e1d57b6de3180b4be9031f64b186 Mon Sep 17 00:00:00 2001 From: Darshit Suratwala Date: Wed, 26 Jun 2024 21:05:17 +0530 Subject: [PATCH 02/12] feat: adding missing openai attributes --- schemas/llm_span_attributes.json | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/schemas/llm_span_attributes.json b/schemas/llm_span_attributes.json index 8c446b8..45ce47b 100644 --- a/schemas/llm_span_attributes.json +++ b/schemas/llm_span_attributes.json @@ -4,6 +4,9 @@ "type": "object", "additionalProperties": false, "properties": { + "gen_ai.api": { + "type": "string" + }, "langtrace.service.name": { "type": "string", "description": "Name of the service. Includes all supported service providers by langtrace" @@ -103,6 +106,9 @@ "type": "boolean", "description": "Search flag from the input request" }, + "gen_ai.request.tool_choice": { + "type": "string" + }, "gen_ai.response.tool_calls": { "type": "string", "description": "Array of tool calls from the response json stringified" @@ -143,6 +149,16 @@ "type": "string", "description": "An array of tool results from the input request json stringified" }, + "gen_ai.request.logit_bias": { + "type": "string", + "description": "Logit bias from the input request" + }, + "gen_ai.request.logprobs": { + "type": "boolean" + }, + "gen_ai.request.top_logprobs": { + "type": "number" + }, "gen_ai.request.embedding_inputs": { "type": "string", "description": "An array of embedding inputs from the input request json stringified" @@ -192,4 +208,4 @@ "url.full", "gen_ai.api" ] -} \ No newline at end of file +} From 8662d25126a476cc7cd7cfb971c34434407c6abf Mon Sep 17 00:00:00 2001 From: Ali Waleed <134522290+alizenhom@users.noreply.github.com> Date: Wed, 26 Jun 2024 19:18:55 +0300 Subject: [PATCH 03/12] Adding spanattributes --- .../langtrace/trace_attributes/__init__.py | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/src/python/langtrace/trace_attributes/__init__.py b/src/python/langtrace/trace_attributes/__init__.py index c22c7f3..40d85c0 100644 --- a/src/python/langtrace/trace_attributes/__init__.py +++ b/src/python/langtrace/trace_attributes/__init__.py @@ -6,6 +6,73 @@ from .models.llm_span_attributes import LLMSpanAttributes +class SpanAttributes(Enum): + LLM_SYSTEM = "gen_ai.system" + LLM_REQUEST_MODEL = "gen_ai.request.model" + LLM_REQUEST_MAX_TOKENS = "gen_ai.request.max_tokens" + LLM_REQUEST_TEMPERATURE = "gen_ai.request.temperature" + LLM_REQUEST_TOP_P = "gen_ai.request.top_p" + LLM_SYSTEM_FINGERPRINT = "gen_ai.system_fingerprint" + + LLM_REQUEST_DOCUMENTS = "gen_ai.request.documents" + LLM_REQUEST_SEARCH_REQUIRED = "gen_ai.request.is_search_required" + LLM_PROMPTS = "gen_ai.prompt" + LLM_COMPLETIONS = "gen_ai.completion" + LLM_RESPONSE_MODEL = "gen_ai.response.model" + LLM_USAGE_COMPLETION_TOKENS = "gen_ai.usage.completion_tokens" + LLM_USAGE_PROMPT_TOKENS = "gen_ai.usage.prompt_tokens" + LLM_USAGE_TOTAL_TOKENS = "gen_ai.request.max_tokens" + LLM_USAGE_TOKEN_TYPE = "gen_ai.usage.token_type" + LLM_TOKEN_TYPE = "gen_ai.token.type" + LLM_RESPONSE_ID = "gen_ai.response_id" + LLM_URL = "url.full" + LLM_PATH = "url.path" + LLM_RESPONSE_FORMAT = "gen_ai.response.format" + LLM_IMAGE_SIZE = "gen_ai.image.size" + LLM_REQUEST_ENCODING_FORMATS = "gen_ai.request.encoding_formats" + LLM_REQUEST_DIMENSIONS = "gen_ai.request.dimensions" + LLM_REQUEST_SEED = "gen_ai.request.seed" + + LLM_REQUEST_TYPE = "gen_ai.request.type" + LLM_HEADERS = "gen_ai.headers" + + LLM_USER = "gen_ai.user" + LLM_TOOLS = "gen_ai.request.tools" + LLM_TOOL_RESULTS = "gen_ai.request.tool_results" + + LLM_TOP_K = "gen_ai.request.top_k" + LLM_IS_STREAMING = "gen_ai.request.stream" + LLM_FREQUENCY_PENALTY = "gen_ai.request.frequency_penalty" + LLM_PRESENCE_PENALTY = "gen_ai.request.presence_penalty" + LLM_CHAT_STOP_SEQUENCES = "gen_ai.chat.stop_sequences" + LLM_REQUEST_FUNCTIONS = "gen_ai.request.functions" + LLM_REQUEST_REPETITION_PENALTY = "gen_ai.request.repetition_penalty" + LLM_RESPONSE_FINISH_REASON = "gen_ai.response.finish_reasons" + LLM_RESPONSE_STOP_REASON = "gen_ai.response.stop_reason" + LLM_CONTENT_COMPLETION_CHUNK = "gen_ai.content.completion.chunk" + + # embeddings + LLM_REQUEST_EMBEDDING_INPUTS = "gen_ai.request.embedding_inputs" + LLM_REQUEST_EMBEDDING_DATASET_ID ="gen_ai_request_embedding_dataset_id" + LLM_REQUEST_EMBEDDING_INPUT_TYPE = "gen_ai.request.embedding_input_type" + LLM_REQUEST_EMBEDDING_JOB_NAME = "gen_ai.request.embedding_job_name" + + # Cohere + LLM_COHERE_RERANK_QUERY = "gen_ai.cohere.rerank.query" + LLM_COHERE_RERANK_RESULTS = "gen_ai.cohere.rerank.results" + + # Langtrace + LANGTRACE_SDK_NAME = "langtrace.sdk.name" + LANGTRACE_SERVICE_NAME = "langtrace.service.name" + LANGTRACE_SERVICE_TYPE = "langtrace.service.type" + LANGTRACE_SERVICE_VERSION = "langtrace.service.version" + LANGTRACE_VERSION = "langtrace.version" + + # Http + HTTP_MAX_RETRIES = "http.max.retries" + HTTP_TIMEOUT = "http.timeout" + + class Event(Enum): STREAM_START = "stream.start" STREAM_OUTPUT = "stream.output" @@ -70,10 +137,16 @@ class WeaviateMethods(Enum): QUERY_NEAR_VECTOR = "weaviate.collections.queries.near_vector" COLLECTIONS_OPERATIONS = "weaviate.collections.collections" +class VendorType(Enum): + LLM = "llm" + VECTOR_DB = "vector_db" + FRAMEWORK = "framework" + # Export only what you want to be accessible directly through `import my_package` __all__ = [ "LLMSpanAttributes", + "SpanAttributes", "DatabaseSpanAttributes", "FrameworkSpanAttributes", "Event", From a0cc9ee1826707d5071a3e0461cc072f68251d1e Mon Sep 17 00:00:00 2001 From: Ali Waleed <134522290+alizenhom@users.noreply.github.com> Date: Wed, 26 Jun 2024 19:47:06 +0300 Subject: [PATCH 04/12] change chunk naming --- src/python/langtrace/trace_attributes/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/langtrace/trace_attributes/__init__.py b/src/python/langtrace/trace_attributes/__init__.py index 40d85c0..7e5a11a 100644 --- a/src/python/langtrace/trace_attributes/__init__.py +++ b/src/python/langtrace/trace_attributes/__init__.py @@ -49,7 +49,7 @@ class SpanAttributes(Enum): LLM_REQUEST_REPETITION_PENALTY = "gen_ai.request.repetition_penalty" LLM_RESPONSE_FINISH_REASON = "gen_ai.response.finish_reasons" LLM_RESPONSE_STOP_REASON = "gen_ai.response.stop_reason" - LLM_CONTENT_COMPLETION_CHUNK = "gen_ai.content.completion.chunk" + LLM_CONTENT_COMPLETION_CHUNK = "gen_ai.completion.chunk" # embeddings LLM_REQUEST_EMBEDDING_INPUTS = "gen_ai.request.embedding_inputs" From f65f9481c03096c44148588a861255fda8854b73 Mon Sep 17 00:00:00 2001 From: Rohit Kadhe Date: Fri, 21 Jun 2024 11:22:43 -0600 Subject: [PATCH 05/12] rename attributes to match otel conventions --- schemas/llm_span_attributes.json | 211 +++++++++++------- .../models/llm_span_attributes.d.ts | 194 ++++++++++++---- .../schemas/llm_span_attributes.json | 211 +++++++++++------- 3 files changed, 406 insertions(+), 210 deletions(-) diff --git a/schemas/llm_span_attributes.json b/schemas/llm_span_attributes.json index 2cce4d9..38525d5 100644 --- a/schemas/llm_span_attributes.json +++ b/schemas/llm_span_attributes.json @@ -5,13 +5,16 @@ "additionalProperties": false, "properties": { "langtrace.service.name": { - "type": "string" + "type": "string", + "description": "Name of the service. Includes all supported service providers by langtrace" }, "langtrace.service.type": { - "type": "string" + "type": "string", + "description": "Type of the service. Allowed values: [llm, vectordb, framework]" }, "langtrace.service.version": { - "type": "string" + "type": "string", + "description": "Version of the service provider client" }, "langtrace.version": { "type": "string" @@ -20,121 +23,152 @@ "type": "string" }, "url.full": { - "type": "string" + "type": "string", + "description": "Full URL of the request" }, - "llm.api": { - "type": "string" + "url.path": { + "type": "string", + "description": "Path of the request" }, - "llm.model": { - "type": "string" + "gen_ai.request.model": { + "type": "string", + "description": "Model name from the input request" }, - "llm.temperature": { - "type": "number", - "format": "float" + "gen_ai.response.model": { + "type": "string", + "description": "Model name from the response" }, - "llm.top_p": { + "gen_ai.request.temperature": { "type": "number", - "format": "float" + "description": "Temperature value from the input request" }, - "llm.top_k": { + "gen_ai.request.top_logprobs": { "type": "number", - "format": "float" - }, - "llm.user": { - "type": "string" - }, - "llm.system.fingerprint": { - "type": "string" - }, - "llm.prompts": { - "type": "string" + "description": "Top log probs value from the input request" }, - "llm.responses": { - "type": "string" + "gen_ai.request.top_p": { + "type": "number", + "format": "float", + "description": "Top P value from the input request" }, - "llm.token.counts": { - "type": "string" + "gen_ai.request.top_k": { + "type": "number", + "format": "float", + "description": "Top K results to return from the input request" }, - "llm.stream": { - "type": "boolean" + "gen_ai.user": { + "type": "string", + "description": "User ID from the input request" }, - "llm.encoding.formats": { - "type": "string" + "gen_ai.prompt": { + "type": "string", + "description": "Prompt text from the input request" }, - "llm.dimensions": { - "type": "string" + "gen_ai.completion": { + "type": "string", + "description": "Completion text from the response. This will be an array of json objects with the following format {\"role\": \"\", \"content\": \"\"}. Role can be one of the following values: [system, user, assistant, tool]" }, - "llm.generation_id": { - "type": "string" + "gen_ai.request.stream": { + "type": "boolean", + "description": "Stream flag from the input request" }, - "llm.response_id": { - "type": "string" + "gen_ai.request.encoding_formats": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Encoding formats from the input request. Allowed values: ['float', 'int8','uint8', 'binary', 'ubinary', 'base64']" }, - "llm.citations": { - "type": "string" + "gen_ai.request.dimensions": { + "type": "number", + "description": "Dimensions from the input request" }, - "llm.documents": { - "type": "string" + "gen_ai.response_id": { + "type": "string", + "description": "Response ID from the output response" }, - "llm.is_search_required": { - "type": "boolean" + "gen_ai.response.finish_reasons": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Array of reasons the model stopped generating tokens, corresponding to each generation received" }, - "llm.search_results": { - "type": "string" + "gen_ai.system_fingerprint": { + "type": "string", + "description": "System fingerprint of the system that generated the response" }, - "llm.tool_calls": { - "type": "string" + "gen_ai.request.documents": { + "type": "string", + "description": "Array of documents from the input request json stringified" }, - "llm.max_tokens": { - "type": "string" + "gen_ai.request.is_search_required": { + "type": "boolean", + "description": "Search flag from the input request" }, - "llm.max_input_tokens": { - "type": "string" + "gen_ai.response.tool_calls": { + "type": "string", + "description": "Array of tool calls from the response json stringified" }, - "llm.conversation_id": { - "type": "string" + "gen_ai.request.max_tokens": { + "type": "number", + "description": "The maximum number of tokens the LLM generates for a request." }, - "llm.seed": { - "type": "string" + "gen_ai.usage.prompt_tokens": { + "type": "number", + "description": "The number of tokens used in the llm prompt." }, - "llm.frequency_penalty": { - "type": "string" + "gen_ai.usage.completion_tokens": { + "type": "number", + "description": "The number of tokens in the llm response." }, - "llm.presence_penalty": { - "type": "string" + "gen_ai.request.seed": { + "type": "string", + "description": "Seed from the input request" }, - "llm.connectors": { - "type": "string" + "gen_ai.request.frequency_penalty": { + "type": "number", + "description": "Frequency penalty from the input request" }, - "llm.tools": { - "type": "string" + "gen_ai.request.presence_penalty": { + "type": "number", + "description": "Presence penalty from the input request" }, - "llm.tool_results": { - "type": "string" + "gen_ai.request.connectors": { + "type": "string", + "description": "An array of connectors from the input request json stringified" }, - "llm.embedding_inputs": { - "type": "string" + "gen_ai.request.tools": { + "type": "string", + "description": "An array of tools from the input request json stringified" }, - "llm.embedding_dataset_id": { - "type": "string" + "gen_ai.request.tool_results": { + "type": "string", + "description": "An array of tool results from the input request json stringified" }, - "llm.embedding_input_type": { - "type": "string" + "gen_ai.request.embedding_inputs": { + "type": "string", + "description": "An array of embedding inputs from the input request json stringified" }, - "llm.embedding_job_name": { - "type": "string" + "gen_ai.request.embedding_dataset_id": { + "type": "string", + "description": "Embedding dataset ID from the input request" }, - "llm.retrieval.query": { - "type": "string" + "gen_ai.request.embedding_input_type": { + "type": "string", + "description": "Embedding input type from the input request. Allowed values: [ 'search_document', 'search_query', 'classification', 'clustering']" }, - "llm.retrieval.results": { - "type": "string" + "gen_ai.request.embedding_job_name": { + "type": "string", + "description": "Embedding job name from the input request" }, - "llm.image.size": { - "type": "string" + "gen_ai.image.size": { + "type": "string", + "description": "Image size from the input request. Allowed values: ['256x256', '512x512', '1024x1024']" }, - "llm.response_format": { - "type": "string" + "gen_ai.response_format": { + "type": "string", + "description": "Response format from the input request. Allowed values: ['url', 'b64_json']" }, "http.max.retries": { "type": "integer", @@ -144,8 +178,13 @@ "type": "integer", "format": "int64" }, - "langtrace.testId": { - "type": "string" + "gen_ai.cohere.rerank.query": { + "type": "string", + "description": "Query from the input request for the rerank api" + }, + "gen_ai.cohere.rerank.results": { + "type": "string", + "description": "Results from the rerank api" } }, "required": [ @@ -154,6 +193,6 @@ "langtrace.sdk.name", "langtrace.version", "url.full", - "llm.api" + "url.path" ] -} +} \ No newline at end of file diff --git a/src/typescript/models/llm_span_attributes.d.ts b/src/typescript/models/llm_span_attributes.d.ts index c062a9e..1ff248f 100644 --- a/src/typescript/models/llm_span_attributes.d.ts +++ b/src/typescript/models/llm_span_attributes.d.ts @@ -6,50 +6,168 @@ */ export interface LLMSpanAttributes { + /** + * Name of the service. Includes all supported service providers by langtrace + */ "langtrace.service.name": string; + /** + * Type of the service. Allowed values: [llm, vectordb, framework] + */ "langtrace.service.type": string; + /** + * Version of the service provider client + */ "langtrace.service.version"?: string; "langtrace.version": string; "langtrace.sdk.name": string; + /** + * Full URL of the request + */ "url.full": string; - "llm.api": string; - "llm.model"?: string; - "llm.temperature"?: number; - "llm.top_p"?: number; - "llm.top_k"?: number; - "llm.user"?: string; - "llm.system.fingerprint"?: string; - "llm.prompts"?: string; - "llm.responses"?: string; - "llm.token.counts"?: string; - "llm.stream"?: boolean; - "llm.encoding.formats"?: string; - "llm.dimensions"?: string; - "llm.generation_id"?: string; - "llm.response_id"?: string; - "llm.citations"?: string; - "llm.documents"?: string; - "llm.is_search_required"?: boolean; - "llm.search_results"?: string; - "llm.tool_calls"?: string; - "llm.max_tokens"?: string; - "llm.max_input_tokens"?: string; - "llm.conversation_id"?: string; - "llm.seed"?: string; - "llm.frequency_penalty"?: string; - "llm.presence_penalty"?: string; - "llm.connectors"?: string; - "llm.tools"?: string; - "llm.tool_results"?: string; - "llm.embedding_inputs"?: string; - "llm.embedding_dataset_id"?: string; - "llm.embedding_input_type"?: string; - "llm.embedding_job_name"?: string; - "llm.retrieval.query"?: string; - "llm.retrieval.results"?: string; - "llm.image.size"?: string; - "llm.response_format"?: string; + /** + * Path of the request + */ + "url.path": string; + /** + * Model name from the input request + */ + "gen_ai.request.model"?: string; + /** + * Model name from the response + */ + "gen_ai.response.model"?: string; + /** + * Temperature value from the input request + */ + "gen_ai.request.temperature"?: number; + /** + * Top log probs value from the input request + */ + "gen_ai.request.top_logprobs"?: number; + /** + * Top P value from the input request + */ + "gen_ai.request.top_p"?: number; + /** + * Top K results to return from the input request + */ + "gen_ai.request.top_k"?: number; + /** + * User ID from the input request + */ + "gen_ai.user"?: string; + /** + * Prompt text from the input request + */ + "gen_ai.prompt"?: string; + /** + * Completion text from the response. This will be an array of json objects with the following format {"role": "", "content": ""}. Role can be one of the following values: [system, user, assistant, tool] + */ + "gen_ai.completion"?: string; + /** + * Stream flag from the input request + */ + "gen_ai.request.stream"?: boolean; + /** + * Encoding formats from the input request. Allowed values: ['float', 'int8','uint8', 'binary', 'ubinary', 'base64'] + */ + "gen_ai.request.encoding_formats"?: string[]; + /** + * Dimensions from the input request + */ + "gen_ai.request.dimensions"?: number; + /** + * Response ID from the output response + */ + "gen_ai.response_id"?: string; + /** + * Array of reasons the model stopped generating tokens, corresponding to each generation received + */ + "gen_ai.response.finish_reasons"?: string[]; + /** + * System fingerprint of the system that generated the response + */ + "gen_ai.system_fingerprint"?: string; + /** + * Array of documents from the input request json stringified + */ + "gen_ai.request.documents"?: string; + /** + * Search flag from the input request + */ + "gen_ai.request.is_search_required"?: boolean; + /** + * Array of tool calls from the response json stringified + */ + "gen_ai.response.tool_calls"?: string; + /** + * The maximum number of tokens the LLM generates for a request. + */ + "gen_ai.request.max_tokens"?: number; + /** + * The number of tokens used in the llm prompt. + */ + "gen_ai.usage.prompt_tokens"?: number; + /** + * The number of tokens in the llm response. + */ + "gen_ai.usage.completion_tokens"?: number; + /** + * Seed from the input request + */ + "gen_ai.request.seed"?: string; + /** + * Frequency penalty from the input request + */ + "gen_ai.request.frequency_penalty"?: number; + /** + * Presence penalty from the input request + */ + "gen_ai.request.presence_penalty"?: number; + /** + * An array of connectors from the input request json stringified + */ + "gen_ai.request.connectors"?: string; + /** + * An array of tools from the input request json stringified + */ + "gen_ai.request.tools"?: string; + /** + * An array of tool results from the input request json stringified + */ + "gen_ai.request.tool_results"?: string; + /** + * An array of embedding inputs from the input request json stringified + */ + "gen_ai.request.embedding_inputs"?: string; + /** + * Embedding dataset ID from the input request + */ + "gen_ai.request.embedding_dataset_id"?: string; + /** + * Embedding input type from the input request. Allowed values: [ 'search_document', 'search_query', 'classification', 'clustering'] + */ + "gen_ai.request.embedding_input_type"?: string; + /** + * Embedding job name from the input request + */ + "gen_ai.request.embedding_job_name"?: string; + /** + * Image size from the input request. Allowed values: ['256x256', '512x512', '1024x1024'] + */ + "gen_ai.image.size"?: string; + /** + * Response format from the input request. Allowed values: ['url', 'b64_json'] + */ + "gen_ai.response_format"?: string; "http.max.retries"?: number; "http.timeout"?: number; - "langtrace.testId"?: string; + /** + * Query from the input request for the rerank api + */ + "gen_ai.cohere.rerank.query"?: string; + /** + * Results from the rerank api + */ + "gen_ai.cohere.rerank.results"?: string; } diff --git a/src/typescript/schemas/llm_span_attributes.json b/src/typescript/schemas/llm_span_attributes.json index 2cce4d9..38525d5 100644 --- a/src/typescript/schemas/llm_span_attributes.json +++ b/src/typescript/schemas/llm_span_attributes.json @@ -5,13 +5,16 @@ "additionalProperties": false, "properties": { "langtrace.service.name": { - "type": "string" + "type": "string", + "description": "Name of the service. Includes all supported service providers by langtrace" }, "langtrace.service.type": { - "type": "string" + "type": "string", + "description": "Type of the service. Allowed values: [llm, vectordb, framework]" }, "langtrace.service.version": { - "type": "string" + "type": "string", + "description": "Version of the service provider client" }, "langtrace.version": { "type": "string" @@ -20,121 +23,152 @@ "type": "string" }, "url.full": { - "type": "string" + "type": "string", + "description": "Full URL of the request" }, - "llm.api": { - "type": "string" + "url.path": { + "type": "string", + "description": "Path of the request" }, - "llm.model": { - "type": "string" + "gen_ai.request.model": { + "type": "string", + "description": "Model name from the input request" }, - "llm.temperature": { - "type": "number", - "format": "float" + "gen_ai.response.model": { + "type": "string", + "description": "Model name from the response" }, - "llm.top_p": { + "gen_ai.request.temperature": { "type": "number", - "format": "float" + "description": "Temperature value from the input request" }, - "llm.top_k": { + "gen_ai.request.top_logprobs": { "type": "number", - "format": "float" - }, - "llm.user": { - "type": "string" - }, - "llm.system.fingerprint": { - "type": "string" - }, - "llm.prompts": { - "type": "string" + "description": "Top log probs value from the input request" }, - "llm.responses": { - "type": "string" + "gen_ai.request.top_p": { + "type": "number", + "format": "float", + "description": "Top P value from the input request" }, - "llm.token.counts": { - "type": "string" + "gen_ai.request.top_k": { + "type": "number", + "format": "float", + "description": "Top K results to return from the input request" }, - "llm.stream": { - "type": "boolean" + "gen_ai.user": { + "type": "string", + "description": "User ID from the input request" }, - "llm.encoding.formats": { - "type": "string" + "gen_ai.prompt": { + "type": "string", + "description": "Prompt text from the input request" }, - "llm.dimensions": { - "type": "string" + "gen_ai.completion": { + "type": "string", + "description": "Completion text from the response. This will be an array of json objects with the following format {\"role\": \"\", \"content\": \"\"}. Role can be one of the following values: [system, user, assistant, tool]" }, - "llm.generation_id": { - "type": "string" + "gen_ai.request.stream": { + "type": "boolean", + "description": "Stream flag from the input request" }, - "llm.response_id": { - "type": "string" + "gen_ai.request.encoding_formats": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Encoding formats from the input request. Allowed values: ['float', 'int8','uint8', 'binary', 'ubinary', 'base64']" }, - "llm.citations": { - "type": "string" + "gen_ai.request.dimensions": { + "type": "number", + "description": "Dimensions from the input request" }, - "llm.documents": { - "type": "string" + "gen_ai.response_id": { + "type": "string", + "description": "Response ID from the output response" }, - "llm.is_search_required": { - "type": "boolean" + "gen_ai.response.finish_reasons": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Array of reasons the model stopped generating tokens, corresponding to each generation received" }, - "llm.search_results": { - "type": "string" + "gen_ai.system_fingerprint": { + "type": "string", + "description": "System fingerprint of the system that generated the response" }, - "llm.tool_calls": { - "type": "string" + "gen_ai.request.documents": { + "type": "string", + "description": "Array of documents from the input request json stringified" }, - "llm.max_tokens": { - "type": "string" + "gen_ai.request.is_search_required": { + "type": "boolean", + "description": "Search flag from the input request" }, - "llm.max_input_tokens": { - "type": "string" + "gen_ai.response.tool_calls": { + "type": "string", + "description": "Array of tool calls from the response json stringified" }, - "llm.conversation_id": { - "type": "string" + "gen_ai.request.max_tokens": { + "type": "number", + "description": "The maximum number of tokens the LLM generates for a request." }, - "llm.seed": { - "type": "string" + "gen_ai.usage.prompt_tokens": { + "type": "number", + "description": "The number of tokens used in the llm prompt." }, - "llm.frequency_penalty": { - "type": "string" + "gen_ai.usage.completion_tokens": { + "type": "number", + "description": "The number of tokens in the llm response." }, - "llm.presence_penalty": { - "type": "string" + "gen_ai.request.seed": { + "type": "string", + "description": "Seed from the input request" }, - "llm.connectors": { - "type": "string" + "gen_ai.request.frequency_penalty": { + "type": "number", + "description": "Frequency penalty from the input request" }, - "llm.tools": { - "type": "string" + "gen_ai.request.presence_penalty": { + "type": "number", + "description": "Presence penalty from the input request" }, - "llm.tool_results": { - "type": "string" + "gen_ai.request.connectors": { + "type": "string", + "description": "An array of connectors from the input request json stringified" }, - "llm.embedding_inputs": { - "type": "string" + "gen_ai.request.tools": { + "type": "string", + "description": "An array of tools from the input request json stringified" }, - "llm.embedding_dataset_id": { - "type": "string" + "gen_ai.request.tool_results": { + "type": "string", + "description": "An array of tool results from the input request json stringified" }, - "llm.embedding_input_type": { - "type": "string" + "gen_ai.request.embedding_inputs": { + "type": "string", + "description": "An array of embedding inputs from the input request json stringified" }, - "llm.embedding_job_name": { - "type": "string" + "gen_ai.request.embedding_dataset_id": { + "type": "string", + "description": "Embedding dataset ID from the input request" }, - "llm.retrieval.query": { - "type": "string" + "gen_ai.request.embedding_input_type": { + "type": "string", + "description": "Embedding input type from the input request. Allowed values: [ 'search_document', 'search_query', 'classification', 'clustering']" }, - "llm.retrieval.results": { - "type": "string" + "gen_ai.request.embedding_job_name": { + "type": "string", + "description": "Embedding job name from the input request" }, - "llm.image.size": { - "type": "string" + "gen_ai.image.size": { + "type": "string", + "description": "Image size from the input request. Allowed values: ['256x256', '512x512', '1024x1024']" }, - "llm.response_format": { - "type": "string" + "gen_ai.response_format": { + "type": "string", + "description": "Response format from the input request. Allowed values: ['url', 'b64_json']" }, "http.max.retries": { "type": "integer", @@ -144,8 +178,13 @@ "type": "integer", "format": "int64" }, - "langtrace.testId": { - "type": "string" + "gen_ai.cohere.rerank.query": { + "type": "string", + "description": "Query from the input request for the rerank api" + }, + "gen_ai.cohere.rerank.results": { + "type": "string", + "description": "Results from the rerank api" } }, "required": [ @@ -154,6 +193,6 @@ "langtrace.sdk.name", "langtrace.version", "url.full", - "llm.api" + "url.path" ] -} +} \ No newline at end of file From 2fd000ca9cddc07fdec4f648e940dd5afc0d9989 Mon Sep 17 00:00:00 2001 From: Rohit Kadhe Date: Thu, 27 Jun 2024 10:09:25 -0600 Subject: [PATCH 06/12] add search_units under usage --- schemas/llm_span_attributes.json | 4 ++++ src/typescript/models/llm_span_attributes.d.ts | 4 ++++ src/typescript/schemas/llm_span_attributes.json | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/schemas/llm_span_attributes.json b/schemas/llm_span_attributes.json index 38525d5..10adb08 100644 --- a/schemas/llm_span_attributes.json +++ b/schemas/llm_span_attributes.json @@ -122,6 +122,10 @@ "type": "number", "description": "The number of tokens in the llm response." }, + "gen_ai.usage.search_units": { + "type": "number", + "description": "The number of search units used in the request." + }, "gen_ai.request.seed": { "type": "string", "description": "Seed from the input request" diff --git a/src/typescript/models/llm_span_attributes.d.ts b/src/typescript/models/llm_span_attributes.d.ts index 1ff248f..c1ac59c 100644 --- a/src/typescript/models/llm_span_attributes.d.ts +++ b/src/typescript/models/llm_span_attributes.d.ts @@ -112,6 +112,10 @@ export interface LLMSpanAttributes { * The number of tokens in the llm response. */ "gen_ai.usage.completion_tokens"?: number; + /** + * The number of search units used in the request. + */ + "gen_ai.usage.search_units"?: number; /** * Seed from the input request */ diff --git a/src/typescript/schemas/llm_span_attributes.json b/src/typescript/schemas/llm_span_attributes.json index 38525d5..10adb08 100644 --- a/src/typescript/schemas/llm_span_attributes.json +++ b/src/typescript/schemas/llm_span_attributes.json @@ -122,6 +122,10 @@ "type": "number", "description": "The number of tokens in the llm response." }, + "gen_ai.usage.search_units": { + "type": "number", + "description": "The number of search units used in the request." + }, "gen_ai.request.seed": { "type": "string", "description": "Seed from the input request" From 013ee36dd43f582fd397dee0a14be2193368baa5 Mon Sep 17 00:00:00 2001 From: Rohit Kadhe Date: Thu, 27 Jun 2024 10:36:25 -0600 Subject: [PATCH 07/12] final fixes --- schemas/llm_span_attributes.json | 11 ++++++++++- src/typescript/models/llm_span_attributes.d.ts | 2 +- src/typescript/schemas/llm_span_attributes.json | 11 ++++++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/schemas/llm_span_attributes.json b/schemas/llm_span_attributes.json index 10adb08..dc9a4f0 100644 --- a/schemas/llm_span_attributes.json +++ b/schemas/llm_span_attributes.json @@ -40,10 +40,12 @@ }, "gen_ai.request.temperature": { "type": "number", + "format": "float", "description": "Temperature value from the input request" }, "gen_ai.request.top_logprobs": { "type": "number", + "format": "float", "description": "Top log probs value from the input request" }, "gen_ai.request.top_p": { @@ -81,6 +83,7 @@ }, "gen_ai.request.dimensions": { "type": "number", + "format": "int32", "description": "Dimensions from the input request" }, "gen_ai.response_id": { @@ -112,18 +115,22 @@ }, "gen_ai.request.max_tokens": { "type": "number", + "format": "int32", "description": "The maximum number of tokens the LLM generates for a request." }, "gen_ai.usage.prompt_tokens": { "type": "number", + "format": "int32", "description": "The number of tokens used in the llm prompt." }, "gen_ai.usage.completion_tokens": { "type": "number", + "format": "int32", "description": "The number of tokens in the llm response." }, "gen_ai.usage.search_units": { "type": "number", + "format": "int32", "description": "The number of search units used in the request." }, "gen_ai.request.seed": { @@ -132,10 +139,12 @@ }, "gen_ai.request.frequency_penalty": { "type": "number", + "format": "float", "description": "Frequency penalty from the input request" }, "gen_ai.request.presence_penalty": { "type": "number", + "format": "float", "description": "Presence penalty from the input request" }, "gen_ai.request.connectors": { @@ -170,7 +179,7 @@ "type": "string", "description": "Image size from the input request. Allowed values: ['256x256', '512x512', '1024x1024']" }, - "gen_ai.response_format": { + "gen_ai.request.response_format": { "type": "string", "description": "Response format from the input request. Allowed values: ['url', 'b64_json']" }, diff --git a/src/typescript/models/llm_span_attributes.d.ts b/src/typescript/models/llm_span_attributes.d.ts index c1ac59c..f536f82 100644 --- a/src/typescript/models/llm_span_attributes.d.ts +++ b/src/typescript/models/llm_span_attributes.d.ts @@ -163,7 +163,7 @@ export interface LLMSpanAttributes { /** * Response format from the input request. Allowed values: ['url', 'b64_json'] */ - "gen_ai.response_format"?: string; + "gen_ai.request.response_format"?: string; "http.max.retries"?: number; "http.timeout"?: number; /** diff --git a/src/typescript/schemas/llm_span_attributes.json b/src/typescript/schemas/llm_span_attributes.json index 10adb08..dc9a4f0 100644 --- a/src/typescript/schemas/llm_span_attributes.json +++ b/src/typescript/schemas/llm_span_attributes.json @@ -40,10 +40,12 @@ }, "gen_ai.request.temperature": { "type": "number", + "format": "float", "description": "Temperature value from the input request" }, "gen_ai.request.top_logprobs": { "type": "number", + "format": "float", "description": "Top log probs value from the input request" }, "gen_ai.request.top_p": { @@ -81,6 +83,7 @@ }, "gen_ai.request.dimensions": { "type": "number", + "format": "int32", "description": "Dimensions from the input request" }, "gen_ai.response_id": { @@ -112,18 +115,22 @@ }, "gen_ai.request.max_tokens": { "type": "number", + "format": "int32", "description": "The maximum number of tokens the LLM generates for a request." }, "gen_ai.usage.prompt_tokens": { "type": "number", + "format": "int32", "description": "The number of tokens used in the llm prompt." }, "gen_ai.usage.completion_tokens": { "type": "number", + "format": "int32", "description": "The number of tokens in the llm response." }, "gen_ai.usage.search_units": { "type": "number", + "format": "int32", "description": "The number of search units used in the request." }, "gen_ai.request.seed": { @@ -132,10 +139,12 @@ }, "gen_ai.request.frequency_penalty": { "type": "number", + "format": "float", "description": "Frequency penalty from the input request" }, "gen_ai.request.presence_penalty": { "type": "number", + "format": "float", "description": "Presence penalty from the input request" }, "gen_ai.request.connectors": { @@ -170,7 +179,7 @@ "type": "string", "description": "Image size from the input request. Allowed values: ['256x256', '512x512', '1024x1024']" }, - "gen_ai.response_format": { + "gen_ai.request.response_format": { "type": "string", "description": "Response format from the input request. Allowed values: ['url', 'b64_json']" }, From 256432fa2693644aa94500af2340cce18668824d Mon Sep 17 00:00:00 2001 From: Darshit Suratwala Date: Thu, 27 Jun 2024 22:15:21 +0530 Subject: [PATCH 08/12] feat: adding missing openai attributes --- schemas/llm_span_attributes.json | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/schemas/llm_span_attributes.json b/schemas/llm_span_attributes.json index 6798e38..bbe013d 100644 --- a/schemas/llm_span_attributes.json +++ b/schemas/llm_span_attributes.json @@ -43,10 +43,18 @@ "format": "float", "description": "Temperature value from the input request" }, + "gen_ai.request.logit_bias": { + "type": "string", + "description": "Likelihood bias of the specified tokens the input request." + }, + "gen_ai.request.logprobs": { + "type": "boolean", + "description": "Logprobs flag returns log probabilities." + }, "gen_ai.request.top_logprobs": { "type": "number", "format": "float", - "description": "Top log probs value from the input request" + "description": "Integer between 0 and 5 specifying the number of most likely tokens to return." }, "gen_ai.request.top_p": { "type": "number", @@ -109,6 +117,10 @@ "type": "boolean", "description": "Search flag from the input request" }, + "gen_ai.request.tool_choice": { + "type": "string", + "description": "Tool choice from the input request" + }, "gen_ai.response.tool_calls": { "type": "string", "description": "Array of tool calls from the response json stringified" From 06019b3abc2a8a578d61460f96f7df89448e328f Mon Sep 17 00:00:00 2001 From: Darshit Suratwala Date: Thu, 27 Jun 2024 22:26:37 +0530 Subject: [PATCH 09/12] feat: bump SDK version to 6.0.0 --- setup.py | 2 +- .../models/llm_span_attributes.py | 252 ++++++++++++++---- .../models/llm_span_attributes.d.ts | 14 +- src/typescript/package-lock.json | 4 +- src/typescript/package.json | 4 +- .../schemas/llm_span_attributes.json | 14 +- 6 files changed, 235 insertions(+), 55 deletions(-) diff --git a/setup.py b/setup.py index 228dfd5..29d24bc 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name="trace-attributes", # Choose a unique name for PyPI - version="5.0.4", + version="6.0.0", author="Karthik Kalyanaraman", author_email="karthik@scale3labs.com", description="LangTrace - Trace Attributes", diff --git a/src/python/langtrace/trace_attributes/models/llm_span_attributes.py b/src/python/langtrace/trace_attributes/models/llm_span_attributes.py index e792f57..d77f276 100644 --- a/src/python/langtrace/trace_attributes/models/llm_span_attributes.py +++ b/src/python/langtrace/trace_attributes/models/llm_span_attributes.py @@ -1,10 +1,10 @@ # generated by datamodel-codegen: # filename: llm_span_attributes.json -# timestamp: 2024-06-06T05:12:56+00:00 +# timestamp: 2024-06-27T16:51:15+00:00 from __future__ import annotations -from typing import Optional +from typing import List, Optional from pydantic import BaseModel, ConfigDict, Field @@ -12,55 +12,211 @@ class LLMSpanAttributes(BaseModel): model_config = ConfigDict(extra="allow") - langtrace_service_name: str = Field(..., alias="langtrace.service.name") - langtrace_service_type: str = Field(..., alias="langtrace.service.type") + langtrace_service_name: str = Field( + ..., + alias="langtrace.service.name", + description="Name of the service. Includes all supported service providers by langtrace", + ) + langtrace_service_type: str = Field( + ..., + alias="langtrace.service.type", + description="Type of the service. Allowed values: [llm, vectordb, framework]", + ) langtrace_service_version: Optional[str] = Field( - None, alias="langtrace.service.version" + None, + alias="langtrace.service.version", + description="Version of the service provider client", ) langtrace_version: str = Field(..., alias="langtrace.version") langtrace_sdk_name: str = Field(..., alias="langtrace.sdk.name") - url_full: str = Field(..., alias="url.full") - llm_api: str = Field(..., alias="llm.api") - llm_model: Optional[str] = Field(None, alias="llm.model") - llm_temperature: Optional[float] = Field(None, alias="llm.temperature") - llm_top_p: Optional[float] = Field(None, alias="llm.top_p") - llm_top_k: Optional[float] = Field(None, alias="llm.top_k") - llm_user: Optional[str] = Field(None, alias="llm.user") - llm_system_fingerprint: Optional[str] = Field(None, alias="llm.system.fingerprint") - llm_prompts: Optional[str] = Field(None, alias="llm.prompts") - llm_responses: Optional[str] = Field(None, alias="llm.responses") - llm_token_counts: Optional[str] = Field(None, alias="llm.token.counts") - llm_stream: Optional[bool] = Field(None, alias="llm.stream") - llm_encoding_formats: Optional[str] = Field(None, alias="llm.encoding.formats") - llm_dimensions: Optional[str] = Field(None, alias="llm.dimensions") - llm_generation_id: Optional[str] = Field(None, alias="llm.generation_id") - llm_response_id: Optional[str] = Field(None, alias="llm.response_id") - llm_citations: Optional[str] = Field(None, alias="llm.citations") - llm_documents: Optional[str] = Field(None, alias="llm.documents") - llm_is_search_required: Optional[bool] = Field(None, alias="llm.is_search_required") - llm_search_results: Optional[str] = Field(None, alias="llm.search_results") - llm_tool_calls: Optional[str] = Field(None, alias="llm.tool_calls") - llm_max_tokens: Optional[str] = Field(None, alias="llm.max_tokens") - llm_max_input_tokens: Optional[str] = Field(None, alias="llm.max_input_tokens") - llm_conversation_id: Optional[str] = Field(None, alias="llm.conversation_id") - llm_seed: Optional[str] = Field(None, alias="llm.seed") - llm_frequency_penalty: Optional[str] = Field(None, alias="llm.frequency_penalty") - llm_presence_penalty: Optional[str] = Field(None, alias="llm.presence_penalty") - llm_connectors: Optional[str] = Field(None, alias="llm.connectors") - llm_tools: Optional[str] = Field(None, alias="llm.tools") - llm_tool_results: Optional[str] = Field(None, alias="llm.tool_results") - llm_embedding_inputs: Optional[str] = Field(None, alias="llm.embedding_inputs") - llm_embedding_dataset_id: Optional[str] = Field( - None, alias="llm.embedding_dataset_id" - ) - llm_embedding_input_type: Optional[str] = Field( - None, alias="llm.embedding_input_type" - ) - llm_embedding_job_name: Optional[str] = Field(None, alias="llm.embedding_job_name") - llm_retrieval_query: Optional[str] = Field(None, alias="llm.retrieval.query") - llm_retrieval_results: Optional[str] = Field(None, alias="llm.retrieval.results") - llm_image_size: Optional[str] = Field(None, alias="llm.image.size") - llm_response_format: Optional[str] = Field(None, alias="llm.response_format") + url_full: str = Field(..., alias="url.full", description="Full URL of the request") + url_path: str = Field(..., alias="url.path", description="Path of the request") + gen_ai_request_model: Optional[str] = Field( + None, + alias="gen_ai.request.model", + description="Model name from the input request", + ) + gen_ai_response_model: Optional[str] = Field( + None, alias="gen_ai.response.model", description="Model name from the response" + ) + gen_ai_request_temperature: Optional[float] = Field( + None, + alias="gen_ai.request.temperature", + description="Temperature value from the input request", + ) + gen_ai_request_logit_bias: Optional[str] = Field( + None, + alias="gen_ai.request.logit_bias", + description="Likelihood bias of the specified tokens the input request.", + ) + gen_ai_request_logprobs: Optional[bool] = Field( + None, + alias="gen_ai.request.logprobs", + description="Logprobs flag returns log probabilities.", + ) + gen_ai_request_top_logprobs: Optional[float] = Field( + None, + alias="gen_ai.request.top_logprobs", + description="Integer between 0 and 5 specifying the number of most likely tokens to return.", + ) + gen_ai_request_top_p: Optional[float] = Field( + None, + alias="gen_ai.request.top_p", + description="Top P value from the input request", + ) + gen_ai_request_top_k: Optional[float] = Field( + None, + alias="gen_ai.request.top_k", + description="Top K results to return from the input request", + ) + gen_ai_user: Optional[str] = Field( + None, alias="gen_ai.user", description="User ID from the input request" + ) + gen_ai_prompt: Optional[str] = Field( + None, alias="gen_ai.prompt", description="Prompt text from the input request" + ) + gen_ai_completion: Optional[str] = Field( + None, + alias="gen_ai.completion", + description='Completion text from the response. This will be an array of json objects with the following format {"role": "", "content": ""}. Role can be one of the following values: [system, user, assistant, tool]', + ) + gen_ai_request_stream: Optional[bool] = Field( + None, + alias="gen_ai.request.stream", + description="Stream flag from the input request", + ) + gen_ai_request_encoding_formats: Optional[List[str]] = Field( + None, + alias="gen_ai.request.encoding_formats", + description="Encoding formats from the input request. Allowed values: ['float', 'int8','uint8', 'binary', 'ubinary', 'base64']", + ) + gen_ai_request_dimensions: Optional[float] = Field( + None, + alias="gen_ai.request.dimensions", + description="Dimensions from the input request", + ) + gen_ai_response_id: Optional[str] = Field( + None, + alias="gen_ai.response_id", + description="Response ID from the output response", + ) + gen_ai_response_finish_reasons: Optional[List[str]] = Field( + None, + alias="gen_ai.response.finish_reasons", + description="Array of reasons the model stopped generating tokens, corresponding to each generation received", + ) + gen_ai_system_fingerprint: Optional[str] = Field( + None, + alias="gen_ai.system_fingerprint", + description="System fingerprint of the system that generated the response", + ) + gen_ai_request_documents: Optional[str] = Field( + None, + alias="gen_ai.request.documents", + description="Array of documents from the input request json stringified", + ) + gen_ai_request_is_search_required: Optional[bool] = Field( + None, + alias="gen_ai.request.is_search_required", + description="Search flag from the input request", + ) + gen_ai_request_tool_choice: Optional[str] = Field( + None, + alias="gen_ai.request.tool_choice", + description="Tool choice from the input request", + ) + gen_ai_response_tool_calls: Optional[str] = Field( + None, + alias="gen_ai.response.tool_calls", + description="Array of tool calls from the response json stringified", + ) + gen_ai_request_max_tokens: Optional[float] = Field( + None, + alias="gen_ai.request.max_tokens", + description="The maximum number of tokens the LLM generates for a request.", + ) + gen_ai_usage_prompt_tokens: Optional[float] = Field( + None, + alias="gen_ai.usage.prompt_tokens", + description="The number of tokens used in the llm prompt.", + ) + gen_ai_usage_completion_tokens: Optional[float] = Field( + None, + alias="gen_ai.usage.completion_tokens", + description="The number of tokens in the llm response.", + ) + gen_ai_usage_search_units: Optional[float] = Field( + None, + alias="gen_ai.usage.search_units", + description="The number of search units used in the request.", + ) + gen_ai_request_seed: Optional[str] = Field( + None, alias="gen_ai.request.seed", description="Seed from the input request" + ) + gen_ai_request_frequency_penalty: Optional[float] = Field( + None, + alias="gen_ai.request.frequency_penalty", + description="Frequency penalty from the input request", + ) + gen_ai_request_presence_penalty: Optional[float] = Field( + None, + alias="gen_ai.request.presence_penalty", + description="Presence penalty from the input request", + ) + gen_ai_request_connectors: Optional[str] = Field( + None, + alias="gen_ai.request.connectors", + description="An array of connectors from the input request json stringified", + ) + gen_ai_request_tools: Optional[str] = Field( + None, + alias="gen_ai.request.tools", + description="An array of tools from the input request json stringified", + ) + gen_ai_request_tool_results: Optional[str] = Field( + None, + alias="gen_ai.request.tool_results", + description="An array of tool results from the input request json stringified", + ) + gen_ai_request_embedding_inputs: Optional[str] = Field( + None, + alias="gen_ai.request.embedding_inputs", + description="An array of embedding inputs from the input request json stringified", + ) + gen_ai_request_embedding_dataset_id: Optional[str] = Field( + None, + alias="gen_ai.request.embedding_dataset_id", + description="Embedding dataset ID from the input request", + ) + gen_ai_request_embedding_input_type: Optional[str] = Field( + None, + alias="gen_ai.request.embedding_input_type", + description="Embedding input type from the input request. Allowed values: [ 'search_document', 'search_query', 'classification', 'clustering']", + ) + gen_ai_request_embedding_job_name: Optional[str] = Field( + None, + alias="gen_ai.request.embedding_job_name", + description="Embedding job name from the input request", + ) + gen_ai_image_size: Optional[str] = Field( + None, + alias="gen_ai.image.size", + description="Image size from the input request. Allowed values: ['256x256', '512x512', '1024x1024']", + ) + gen_ai_request_response_format: Optional[str] = Field( + None, + alias="gen_ai.request.response_format", + description="Response format from the input request. Allowed values: ['url', 'b64_json']", + ) http_max_retries: Optional[int] = Field(None, alias="http.max.retries") http_timeout: Optional[int] = Field(None, alias="http.timeout") - langtrace_testId: Optional[str] = Field(None, alias="langtrace.testId") + gen_ai_cohere_rerank_query: Optional[str] = Field( + None, + alias="gen_ai.cohere.rerank.query", + description="Query from the input request for the rerank api", + ) + gen_ai_cohere_rerank_results: Optional[str] = Field( + None, + alias="gen_ai.cohere.rerank.results", + description="Results from the rerank api", + ) diff --git a/src/typescript/models/llm_span_attributes.d.ts b/src/typescript/models/llm_span_attributes.d.ts index f536f82..fcb4246 100644 --- a/src/typescript/models/llm_span_attributes.d.ts +++ b/src/typescript/models/llm_span_attributes.d.ts @@ -41,7 +41,15 @@ export interface LLMSpanAttributes { */ "gen_ai.request.temperature"?: number; /** - * Top log probs value from the input request + * Likelihood bias of the specified tokens the input request. + */ + "gen_ai.request.logit_bias"?: string; + /** + * Logprobs flag returns log probabilities. + */ + "gen_ai.request.logprobs"?: boolean; + /** + * Integer between 0 and 5 specifying the number of most likely tokens to return. */ "gen_ai.request.top_logprobs"?: number; /** @@ -96,6 +104,10 @@ export interface LLMSpanAttributes { * Search flag from the input request */ "gen_ai.request.is_search_required"?: boolean; + /** + * Tool choice from the input request + */ + "gen_ai.request.tool_choice"?: string; /** * Array of tool calls from the response json stringified */ diff --git a/src/typescript/package-lock.json b/src/typescript/package-lock.json index d8d0106..6eab93d 100644 --- a/src/typescript/package-lock.json +++ b/src/typescript/package-lock.json @@ -1,12 +1,12 @@ { "name": "@langtrase/trace-attributes", - "version": "5.0.3", + "version": "6.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@langtrase/trace-attributes", - "version": "5.0.3", + "version": "6.0.0", "license": "MIT", "dependencies": { "ncp": "^2.0.0" diff --git a/src/typescript/package.json b/src/typescript/package.json index 1feba9d..f16d441 100644 --- a/src/typescript/package.json +++ b/src/typescript/package.json @@ -1,6 +1,6 @@ { "name": "@langtrase/trace-attributes", - "version": "5.0.4", + "version": "6.0.0", "description": "LangTrace - Trace Attributes", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -19,4 +19,4 @@ "devDependencies": { "typescript": "^4.0.0" } -} \ No newline at end of file +} diff --git a/src/typescript/schemas/llm_span_attributes.json b/src/typescript/schemas/llm_span_attributes.json index 6798e38..bbe013d 100644 --- a/src/typescript/schemas/llm_span_attributes.json +++ b/src/typescript/schemas/llm_span_attributes.json @@ -43,10 +43,18 @@ "format": "float", "description": "Temperature value from the input request" }, + "gen_ai.request.logit_bias": { + "type": "string", + "description": "Likelihood bias of the specified tokens the input request." + }, + "gen_ai.request.logprobs": { + "type": "boolean", + "description": "Logprobs flag returns log probabilities." + }, "gen_ai.request.top_logprobs": { "type": "number", "format": "float", - "description": "Top log probs value from the input request" + "description": "Integer between 0 and 5 specifying the number of most likely tokens to return." }, "gen_ai.request.top_p": { "type": "number", @@ -109,6 +117,10 @@ "type": "boolean", "description": "Search flag from the input request" }, + "gen_ai.request.tool_choice": { + "type": "string", + "description": "Tool choice from the input request" + }, "gen_ai.response.tool_calls": { "type": "string", "description": "Array of tool calls from the response json stringified" From 7a66d7d6a165f68bee833578a31be9d74ea33c5f Mon Sep 17 00:00:00 2001 From: Ali Waleed <134522290+alizenhom@users.noreply.github.com> Date: Fri, 28 Jun 2024 21:14:48 +0300 Subject: [PATCH 10/12] add generation and search units --- src/python/langtrace/trace_attributes/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/python/langtrace/trace_attributes/__init__.py b/src/python/langtrace/trace_attributes/__init__.py index 7e5a11a..5ae42ee 100644 --- a/src/python/langtrace/trace_attributes/__init__.py +++ b/src/python/langtrace/trace_attributes/__init__.py @@ -23,6 +23,8 @@ class SpanAttributes(Enum): LLM_USAGE_PROMPT_TOKENS = "gen_ai.usage.prompt_tokens" LLM_USAGE_TOTAL_TOKENS = "gen_ai.request.max_tokens" LLM_USAGE_TOKEN_TYPE = "gen_ai.usage.token_type" + LLM_USAGE_SEARCH_UNITS = "gen_ai.usage.search_units" + LLM_GENERATION_ID = "gen_ai.generation_id" LLM_TOKEN_TYPE = "gen_ai.token.type" LLM_RESPONSE_ID = "gen_ai.response_id" LLM_URL = "url.full" From a92384d03bb44c38cba8cefb65b0510928b0a346 Mon Sep 17 00:00:00 2001 From: Ali Waleed <134522290+alizenhom@users.noreply.github.com> Date: Mon, 1 Jul 2024 16:09:48 +0300 Subject: [PATCH 11/12] remove enum --- src/python/langtrace/trace_attributes/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/langtrace/trace_attributes/__init__.py b/src/python/langtrace/trace_attributes/__init__.py index 5ae42ee..2d3e485 100644 --- a/src/python/langtrace/trace_attributes/__init__.py +++ b/src/python/langtrace/trace_attributes/__init__.py @@ -6,7 +6,7 @@ from .models.llm_span_attributes import LLMSpanAttributes -class SpanAttributes(Enum): +class SpanAttributes: LLM_SYSTEM = "gen_ai.system" LLM_REQUEST_MODEL = "gen_ai.request.model" LLM_REQUEST_MAX_TOKENS = "gen_ai.request.max_tokens" From 35f4e17a7c343620a53b78e680e425b27c154ea5 Mon Sep 17 00:00:00 2001 From: Ali Waleed <134522290+alizenhom@users.noreply.github.com> Date: Tue, 2 Jul 2024 18:56:26 +0300 Subject: [PATCH 12/12] add logprobs --- src/python/langtrace/trace_attributes/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/python/langtrace/trace_attributes/__init__.py b/src/python/langtrace/trace_attributes/__init__.py index 2d3e485..a67493b 100644 --- a/src/python/langtrace/trace_attributes/__init__.py +++ b/src/python/langtrace/trace_attributes/__init__.py @@ -34,6 +34,12 @@ class SpanAttributes: LLM_REQUEST_ENCODING_FORMATS = "gen_ai.request.encoding_formats" LLM_REQUEST_DIMENSIONS = "gen_ai.request.dimensions" LLM_REQUEST_SEED = "gen_ai.request.seed" + LLM_REQUEST_TOP_LOGPROPS = "gen_ai.request.top_props" + LLM_REQUEST_LOGPROPS = "gen_ai.request.log_props" + LLM_REQUEST_LOGITBIAS = "gen_ai.request.logit_bias" + + + LLM_REQUEST_TYPE = "gen_ai.request.type" LLM_HEADERS = "gen_ai.headers"