ai.observe
Modules
ai.observe
Module ai.observe
API
Declarations
ballerina/ai.observe Ballerina library
Functions
createChatSpan
Creates a span representing a chat model interaction.
Parameters
- llmModel string - The name of the LLM or chat model used
Return Type
- ChatSpan - A
ChatSpaninstance representing the span
createCreateAgentSpan
function createCreateAgentSpan(string agentName) returns CreateAgentSpanCreates a span representing the creation of an AI agent.
Parameters
- agentName string - The name of the agent being created
Return Type
- CreateAgentSpan - A
CreateAgentSpaninstance representing the span
createCreateKnowledgeBaseSpan
function createCreateKnowledgeBaseSpan(string kbName) returns CreateKnowledgeBaseSpanCreates a span representing the creation of a knowledge base.
Parameters
- kbName string - The name of the knowledge base being created
Return Type
- CreateKnowledgeBaseSpan - A
CreateKnowledgeBaseSpaninstance representing the span
createEmbeddingSpan
function createEmbeddingSpan(string embeddingModel) returns EmbeddingSpanCreates a span representing an embedding generation operation.
Parameters
- embeddingModel string - The embedding model name or identifier
Return Type
- EmbeddingSpan - An
EmbeddingSpaninstance representing the span
createExecuteToolSpan
function createExecuteToolSpan(string toolName) returns ExecuteToolSpanCreates a span representing the execution of an AI tool.
Parameters
- toolName string - The name of the tool being executed
Return Type
- ExecuteToolSpan - An
ExecuteToolSpaninstance representing the span
createGenerateContentSpan
function createGenerateContentSpan(string llmModel) returns GenerateContentSpanCreates a span representing a generate content LLM interaction.
Parameters
- llmModel string - The name of the LLM or chat model used
Return Type
- GenerateContentSpan - A
GenerateContentSpaninstance representing the span
createInvokeAgentSpan
function createInvokeAgentSpan(string agentName) returns InvokeAgentSpanCreates a span representing the invocation of an AI agent.
Parameters
- agentName string - The name of the agent being invoked
Return Type
- InvokeAgentSpan - An
InvokeAgentSpaninstance representing the span
createKnowledgeBaseIngestSpan
function createKnowledgeBaseIngestSpan(string kbName) returns KnowledgeBaseIngestSpanCreates a span representing ingestion into a knowledge base.
Parameters
- kbName string - The name of the knowledge base being ingested into
Return Type
- KnowledgeBaseIngestSpan - A
KnowledgeBaseIngestSpaninstance representing the span
createKnowledgeBaseRetrieveSpan
function createKnowledgeBaseRetrieveSpan(string kbName) returns KnowledgeBaseRetrieveSpanCreates a span representing a retrieval operation from a knowledge base.
Parameters
- kbName string - The name of the knowledge base being queried
Return Type
- KnowledgeBaseRetrieveSpan - A
KnowledgeBaseRetrieveSpaninstance representing the span
getCurrentAiSpan
function getCurrentAiSpan() returns AiSpan?Retrieves the current active AI span, if any.
Returns the AiSpan associated with the current execution context.
If tracing is not enabled or no span exists for the current context, returns ().
Return Type
- AiSpan? -
- The current active AI span, or
()if none is active
- The current active AI span, or
Classes
ai.observe: ChatSpan
Chat-specific LLM span implementation for chat operations.
addTag
function addTag("gen_ai.knowledge_base.retrieve.input.filter"|"gen_ai.knowledge_base.retrieve.input.limit"|"gen_ai.knowledge_base.retrieve.input.query"|"gen_ai.knowledge_base.ingest.input.chunks"|"gen_ai.knowledge_base.id"|"gen_ai.knowledge_base.name"|"gen_ai.input.tools"|"gen_ai.input.content"|"gen_ai.tool.output"|"gen_ai.tool.arguments"|"gen_ai.tool.type"|"gen_ai.tool.description"|"gen_ai.tool.name"|"gen_ai.tool.call.id"|"gen_ai.agent.tools"|"gen_ai.agent.name"|"gen_ai.agent.id"|"gen_ai.system_instructions"|"gen_ai.output.messages"|"gen_ai.input.messages"|"gen_ai.usage.output_tokens"|"gen_ai.usage.input_tokens"|"gen_ai.response.id"|"gen_ai.response.finish_reasons"|"gen_ai.request.temperature"|"gen_ai.request.stop_sequences"|"gen_ai.response.model"|"gen_ai.request.model"|"gen_ai.output.type"|"gen_ai.conversation.id"|"gen_ai.provider.name"|"gen_ai.operation.name" key, anydata value) returns ()Adds a tag to the span.
Method included from *LlmSpan
addProvider
function addProvider(string providerName)Records the provider name used for the request.
Parameters
- providerName string - The name of the AI provider/service (for example:
openai)
addTemperature
Records the temperature setting used for the request.
addInputMessages
function addInputMessages(json messages)Records the input messages payload for the request.
Parameters
- messages json - The input messages sent to the model
addOutputMessages
function addOutputMessages(json messages)Records the output messages payload produced by the model.
Parameters
- messages json - The output messages returned by the model
addResponseModel
function addResponseModel(string modelName)Records the model name used for the response.
Parameters
- modelName string - The model identifier/name used to generate the response (for example:
gpt-40-2024)
addTools
function addTools(json[] tools)Records the tools schema send to the model.
Parameters
- tools json[] - An array of tool schemas sent the the model
addResponseId
Records the response identifier assigned by the provider.
addInputTokenCount
function addInputTokenCount(int count)Records the count of input tokens consumed by the request.
Parameters
- count int - Number of input tokens consumed
addOutputTokenCount
function addOutputTokenCount(int count)Records the count of output tokens produced by the response.
Parameters
- count int - Number of output tokens produced
addFinishReason
Records the finish reason(s) returned by the model.
Parameters
addOutputType
function addOutputType(OutputType outputType)Sets the response output type (e.g., text or json).
Parameters
- outputType OutputType - The output type describing the response format
addStopSequence
Records one or more stop sequences supplied to the model.
close
function close(error? err)Closes the span and records its final status.
Parameters
- err error? (default ()) - Optional error that indicates if the operation failed
ai.observe: CreateAgentSpan
Represents a tracing span for creating an agent.
addTag
function addTag("gen_ai.knowledge_base.retrieve.input.filter"|"gen_ai.knowledge_base.retrieve.input.limit"|"gen_ai.knowledge_base.retrieve.input.query"|"gen_ai.knowledge_base.ingest.input.chunks"|"gen_ai.knowledge_base.id"|"gen_ai.knowledge_base.name"|"gen_ai.input.tools"|"gen_ai.input.content"|"gen_ai.tool.output"|"gen_ai.tool.arguments"|"gen_ai.tool.type"|"gen_ai.tool.description"|"gen_ai.tool.name"|"gen_ai.tool.call.id"|"gen_ai.agent.tools"|"gen_ai.agent.name"|"gen_ai.agent.id"|"gen_ai.system_instructions"|"gen_ai.output.messages"|"gen_ai.input.messages"|"gen_ai.usage.output_tokens"|"gen_ai.usage.input_tokens"|"gen_ai.response.id"|"gen_ai.response.finish_reasons"|"gen_ai.request.temperature"|"gen_ai.request.stop_sequences"|"gen_ai.response.model"|"gen_ai.request.model"|"gen_ai.output.type"|"gen_ai.conversation.id"|"gen_ai.provider.name"|"gen_ai.operation.name" key, anydata value) returns ()Adds a tag to the span.
Method included from *AiSpan
addId
function addId(string agentId)Records the agent ID assigned after creation.
Parameters
- agentId string - The agent identifier
addSystemInstructions
function addSystemInstructions(string instructions)Records system instruction of the agent.
Parameters
- instructions string - The system instructions string
addTools
function addTools(json tools)Records the tools used by the agent.
Parameters
- tools json - Tools used by the agent
close
function close(error? err)Closes the agent creation span and records its final status.
Parameters
- err error? (default ()) - Optional error that indicates if the operation failed
ai.observe: CreateKnowledgeBaseSpan
Represents a tracing span for creating a knowledge base.
addTag
function addTag("gen_ai.knowledge_base.retrieve.input.filter"|"gen_ai.knowledge_base.retrieve.input.limit"|"gen_ai.knowledge_base.retrieve.input.query"|"gen_ai.knowledge_base.ingest.input.chunks"|"gen_ai.knowledge_base.id"|"gen_ai.knowledge_base.name"|"gen_ai.input.tools"|"gen_ai.input.content"|"gen_ai.tool.output"|"gen_ai.tool.arguments"|"gen_ai.tool.type"|"gen_ai.tool.description"|"gen_ai.tool.name"|"gen_ai.tool.call.id"|"gen_ai.agent.tools"|"gen_ai.agent.name"|"gen_ai.agent.id"|"gen_ai.system_instructions"|"gen_ai.output.messages"|"gen_ai.input.messages"|"gen_ai.usage.output_tokens"|"gen_ai.usage.input_tokens"|"gen_ai.response.id"|"gen_ai.response.finish_reasons"|"gen_ai.request.temperature"|"gen_ai.request.stop_sequences"|"gen_ai.response.model"|"gen_ai.request.model"|"gen_ai.output.type"|"gen_ai.conversation.id"|"gen_ai.provider.name"|"gen_ai.operation.name" key, anydata value) returns ()Adds a tag to the span.
Method included from *AiSpan
addId
Records the knowledge base ID assigned after creation
close
function close(error? err)Closes the knowledge base creation span and records its final status.
Parameters
- err error? (default ()) - Optional error that indicates if the operation failed
ai.observe: EmbeddingSpan
Represents a tracing span for embedding model operations.
addTag
function addTag("gen_ai.knowledge_base.retrieve.input.filter"|"gen_ai.knowledge_base.retrieve.input.limit"|"gen_ai.knowledge_base.retrieve.input.query"|"gen_ai.knowledge_base.ingest.input.chunks"|"gen_ai.knowledge_base.id"|"gen_ai.knowledge_base.name"|"gen_ai.input.tools"|"gen_ai.input.content"|"gen_ai.tool.output"|"gen_ai.tool.arguments"|"gen_ai.tool.type"|"gen_ai.tool.description"|"gen_ai.tool.name"|"gen_ai.tool.call.id"|"gen_ai.agent.tools"|"gen_ai.agent.name"|"gen_ai.agent.id"|"gen_ai.system_instructions"|"gen_ai.output.messages"|"gen_ai.input.messages"|"gen_ai.usage.output_tokens"|"gen_ai.usage.input_tokens"|"gen_ai.response.id"|"gen_ai.response.finish_reasons"|"gen_ai.request.temperature"|"gen_ai.request.stop_sequences"|"gen_ai.response.model"|"gen_ai.request.model"|"gen_ai.output.type"|"gen_ai.conversation.id"|"gen_ai.provider.name"|"gen_ai.operation.name" key, anydata value) returns ()Adds a tag to the span.
Method included from *AiSpan
addResponseModel
function addResponseModel(string model)Records the response model name used for the embedding.
Parameters
- model string - The model identifier/name used to generate the embedding
addProvider
function addProvider(string providerName)Records the provider name used for the embedding request.
Parameters
- providerName string - The name of the AI provider/service (for example:
openai)
addInputContent
function addInputContent(anydata content)Records the input content for the embedding request.
Parameters
- content anydata - The input content to be embedded
addInputTokenCount
function addInputTokenCount(int count)Records the input token count for the embedding request.
Parameters
- count int - Number of input tokens consumed
close
function close(error? err)Closes the embedding span and records its final status.
Parameters
- err error? (default ()) - Optional error that indicates if the operation failed
ai.observe: ExecuteToolSpan
Represents a tracing span for executing a tool.
addTag
function addTag("gen_ai.knowledge_base.retrieve.input.filter"|"gen_ai.knowledge_base.retrieve.input.limit"|"gen_ai.knowledge_base.retrieve.input.query"|"gen_ai.knowledge_base.ingest.input.chunks"|"gen_ai.knowledge_base.id"|"gen_ai.knowledge_base.name"|"gen_ai.input.tools"|"gen_ai.input.content"|"gen_ai.tool.output"|"gen_ai.tool.arguments"|"gen_ai.tool.type"|"gen_ai.tool.description"|"gen_ai.tool.name"|"gen_ai.tool.call.id"|"gen_ai.agent.tools"|"gen_ai.agent.name"|"gen_ai.agent.id"|"gen_ai.system_instructions"|"gen_ai.output.messages"|"gen_ai.input.messages"|"gen_ai.usage.output_tokens"|"gen_ai.usage.input_tokens"|"gen_ai.response.id"|"gen_ai.response.finish_reasons"|"gen_ai.request.temperature"|"gen_ai.request.stop_sequences"|"gen_ai.response.model"|"gen_ai.request.model"|"gen_ai.output.type"|"gen_ai.conversation.id"|"gen_ai.provider.name"|"gen_ai.operation.name" key, anydata value) returns ()Adds a tag to the span.
Method included from *AiSpan
addId
Records the tool call ID of the execution.
addDescription
function addDescription(string description)Records the tool description of the execution.
Parameters
- description string - The tool description string
addType
function addType(ToolType toolType)Records the tool type of the execution.
Parameters
- toolType ToolType - The tool type
addArguments
function addArguments(json arguments)Records arguments of the tool execution.
Parameters
- arguments json - The tool arguments
addOutput
function addOutput(anydata output)Records output of the tool execution.
Parameters
- output anydata - The output produced by the tool
close
function close(error? err)Closes the tool execution span and records its final status.
Parameters
- err error? (default ()) - Optional error that indicates if the operation failed
ai.observe: GenerateContentSpan
Generate-content specific LLM span implementation.
addTag
function addTag("gen_ai.knowledge_base.retrieve.input.filter"|"gen_ai.knowledge_base.retrieve.input.limit"|"gen_ai.knowledge_base.retrieve.input.query"|"gen_ai.knowledge_base.ingest.input.chunks"|"gen_ai.knowledge_base.id"|"gen_ai.knowledge_base.name"|"gen_ai.input.tools"|"gen_ai.input.content"|"gen_ai.tool.output"|"gen_ai.tool.arguments"|"gen_ai.tool.type"|"gen_ai.tool.description"|"gen_ai.tool.name"|"gen_ai.tool.call.id"|"gen_ai.agent.tools"|"gen_ai.agent.name"|"gen_ai.agent.id"|"gen_ai.system_instructions"|"gen_ai.output.messages"|"gen_ai.input.messages"|"gen_ai.usage.output_tokens"|"gen_ai.usage.input_tokens"|"gen_ai.response.id"|"gen_ai.response.finish_reasons"|"gen_ai.request.temperature"|"gen_ai.request.stop_sequences"|"gen_ai.response.model"|"gen_ai.request.model"|"gen_ai.output.type"|"gen_ai.conversation.id"|"gen_ai.provider.name"|"gen_ai.operation.name" key, anydata value) returns ()Adds a tag to the span.
Method included from *LlmSpan
addProvider
function addProvider(string providerName)Records the provider name used for the request.
Parameters
- providerName string - The name of the AI provider/service (for example:
openai)
addTemperature
Records the temperature setting used for the request.
addInputMessages
function addInputMessages(json messages)Records the input messages payload for the request.
Parameters
- messages json - The input messages sent to the model
addOutputMessages
function addOutputMessages(json messages)Records the output messages payload produced by the model.
Parameters
- messages json - The output messages returned by the model
addResponseModel
function addResponseModel(string modelName)Records the model name used for the response.
Parameters
- modelName string - The model identifier/name used to generate the response (for example:
gpt-40-2024)
addTools
function addTools(json[] tools)Records the tools schema send to the model.
Parameters
- tools json[] - An array of tool schemas sent the the model
addResponseId
Records the response identifier assigned by the provider.
addInputTokenCount
function addInputTokenCount(int count)Records the count of input tokens consumed by the request.
Parameters
- count int - Number of input tokens consumed
addOutputTokenCount
function addOutputTokenCount(int count)Records the count of output tokens produced by the response.
Parameters
- count int - Number of output tokens produced
addFinishReason
Records the finish reason(s) returned by the model.
Parameters
addOutputType
function addOutputType(OutputType outputType)Sets the response output type (e.g., text or json).
Parameters
- outputType OutputType - The output type describing the response format
addStopSequence
Records one or more stop sequences supplied to the model.
close
function close(error? err)Closes the span and records its final status.
Parameters
- err error? (default ()) - Optional error that indicates if the operation failed
ai.observe: InvokeAgentSpan
Represents a tracing span for invoking an agent.
addTag
function addTag("gen_ai.knowledge_base.retrieve.input.filter"|"gen_ai.knowledge_base.retrieve.input.limit"|"gen_ai.knowledge_base.retrieve.input.query"|"gen_ai.knowledge_base.ingest.input.chunks"|"gen_ai.knowledge_base.id"|"gen_ai.knowledge_base.name"|"gen_ai.input.tools"|"gen_ai.input.content"|"gen_ai.tool.output"|"gen_ai.tool.arguments"|"gen_ai.tool.type"|"gen_ai.tool.description"|"gen_ai.tool.name"|"gen_ai.tool.call.id"|"gen_ai.agent.tools"|"gen_ai.agent.name"|"gen_ai.agent.id"|"gen_ai.system_instructions"|"gen_ai.output.messages"|"gen_ai.input.messages"|"gen_ai.usage.output_tokens"|"gen_ai.usage.input_tokens"|"gen_ai.response.id"|"gen_ai.response.finish_reasons"|"gen_ai.request.temperature"|"gen_ai.request.stop_sequences"|"gen_ai.response.model"|"gen_ai.request.model"|"gen_ai.output.type"|"gen_ai.conversation.id"|"gen_ai.provider.name"|"gen_ai.operation.name" key, anydata value) returns ()Adds a tag to the span.
Method included from *AiSpan
addId
function addId(string agentId)Records the agent ID of the invocation.
Parameters
- agentId string - The agent identifier
addSystemInstruction
function addSystemInstruction(string instruction)Records system instruction of the agent.
Parameters
- instruction string - The system instruction
addSessionId
function addSessionId(string sessionId)Records the session ID of the invocation.
Parameters
- sessionId string - The session/conversation identifier
addInput
function addInput(string query)Records the input query of the agent invocation.
Parameters
- query string - The input query string
addOutput
function addOutput(OutputType outputType, json output)Records the output of the agent invocation.
close
function close(error? err)Closes the agent invocation span and records its final status.
Parameters
- err error? (default ()) - Optional error that indicates if the operation failed
ai.observe: KnowledgeBaseIngestSpan
Represents a tracing span for ingesting data into a knowledge base.
addTag
function addTag("gen_ai.knowledge_base.retrieve.input.filter"|"gen_ai.knowledge_base.retrieve.input.limit"|"gen_ai.knowledge_base.retrieve.input.query"|"gen_ai.knowledge_base.ingest.input.chunks"|"gen_ai.knowledge_base.id"|"gen_ai.knowledge_base.name"|"gen_ai.input.tools"|"gen_ai.input.content"|"gen_ai.tool.output"|"gen_ai.tool.arguments"|"gen_ai.tool.type"|"gen_ai.tool.description"|"gen_ai.tool.name"|"gen_ai.tool.call.id"|"gen_ai.agent.tools"|"gen_ai.agent.name"|"gen_ai.agent.id"|"gen_ai.system_instructions"|"gen_ai.output.messages"|"gen_ai.input.messages"|"gen_ai.usage.output_tokens"|"gen_ai.usage.input_tokens"|"gen_ai.response.id"|"gen_ai.response.finish_reasons"|"gen_ai.request.temperature"|"gen_ai.request.stop_sequences"|"gen_ai.response.model"|"gen_ai.request.model"|"gen_ai.output.type"|"gen_ai.conversation.id"|"gen_ai.provider.name"|"gen_ai.operation.name" key, anydata value) returns ()Adds a tag to the span.
Method included from *AiSpan
addId
Records the knowledge base ID for the ingest operation.
addInputChunks
function addInputChunks(json chunks)Records the input chunks provied/generated for the ingest operation
Parameters
- chunks json - The input chunks to be ingested
close
function close(error? err)Closes the ingest span and records its final status
Parameters
- err error? (default ()) - Optional error that indicates if the operation failed
ai.observe: KnowledgeBaseRetrieveSpan
Represents a tracing span for retrieving data from a knowledge base.
addTag
function addTag("gen_ai.knowledge_base.retrieve.input.filter"|"gen_ai.knowledge_base.retrieve.input.limit"|"gen_ai.knowledge_base.retrieve.input.query"|"gen_ai.knowledge_base.ingest.input.chunks"|"gen_ai.knowledge_base.id"|"gen_ai.knowledge_base.name"|"gen_ai.input.tools"|"gen_ai.input.content"|"gen_ai.tool.output"|"gen_ai.tool.arguments"|"gen_ai.tool.type"|"gen_ai.tool.description"|"gen_ai.tool.name"|"gen_ai.tool.call.id"|"gen_ai.agent.tools"|"gen_ai.agent.name"|"gen_ai.agent.id"|"gen_ai.system_instructions"|"gen_ai.output.messages"|"gen_ai.input.messages"|"gen_ai.usage.output_tokens"|"gen_ai.usage.input_tokens"|"gen_ai.response.id"|"gen_ai.response.finish_reasons"|"gen_ai.request.temperature"|"gen_ai.request.stop_sequences"|"gen_ai.response.model"|"gen_ai.request.model"|"gen_ai.output.type"|"gen_ai.conversation.id"|"gen_ai.provider.name"|"gen_ai.operation.name" key, anydata value) returns ()Adds a tag to the span.
Method included from *AiSpan
addId
Records the knowledge base ID for the retrieve operation.
addInputQuery
function addInputQuery(json query)Records the input query for the retrieve operation.
Parameters
- query json - The input query to retrieve data
addLimit
function addLimit(int maxLimit)Records the maximum limit for the retrieve operation.
Parameters
- maxLimit int - The maximum number of results to retrieve
addFilter
function addFilter(json filter)Records the filter for the retrieve operation.
Parameters
- filter json - The filter criteria for retrieval
close
function close(error? err)Closes the retrieve span and records its final status.
Parameters
- err error? (default ()) - Optional error that indicates if the operation failed
Enums
ai.observe: OutputType
Represents the type of output produced by an LLM.
Members
ai.observe: ToolType
Identifies the type of tool used by an agent.
Members
Object types
ai.observe: AiSpan
Represents an AI tracing span that allows adding tags and closing the span.
close
function close(error? err)Closes the span and records its final status.
Parameters
- err error? (default ()) -
ai.observe: LlmSpan
Represents an LLM-specific tracing span for LLM calls.
addTag
function addTag("gen_ai.knowledge_base.retrieve.input.filter"|"gen_ai.knowledge_base.retrieve.input.limit"|"gen_ai.knowledge_base.retrieve.input.query"|"gen_ai.knowledge_base.ingest.input.chunks"|"gen_ai.knowledge_base.id"|"gen_ai.knowledge_base.name"|"gen_ai.input.tools"|"gen_ai.input.content"|"gen_ai.tool.output"|"gen_ai.tool.arguments"|"gen_ai.tool.type"|"gen_ai.tool.description"|"gen_ai.tool.name"|"gen_ai.tool.call.id"|"gen_ai.agent.tools"|"gen_ai.agent.name"|"gen_ai.agent.id"|"gen_ai.system_instructions"|"gen_ai.output.messages"|"gen_ai.input.messages"|"gen_ai.usage.output_tokens"|"gen_ai.usage.input_tokens"|"gen_ai.response.id"|"gen_ai.response.finish_reasons"|"gen_ai.request.temperature"|"gen_ai.request.stop_sequences"|"gen_ai.response.model"|"gen_ai.request.model"|"gen_ai.output.type"|"gen_ai.conversation.id"|"gen_ai.provider.name"|"gen_ai.operation.name" key, anydata value) returns ()Adds a tag to the span.
Method included from *AiSpan
close
function close(error|() err) returns ()Closes the span and records its final status.
Method included from *AiSpan
addProvider
function addProvider(string providerName)Records the provider name used for the request.
Parameters
- providerName string - The name of the AI provider/service (for example:
openai)
addTemperature
Records the temperature setting used for the request.
addInputMessages
function addInputMessages(json messages)Records the input messages payload for the request.
Parameters
- messages json - The input messages sent to the model
addOutputMessages
function addOutputMessages(json messages)Records the output messages payload produced by the model.
Parameters
- messages json - The output messages returned by the model
addResponseModel
function addResponseModel(string modelName)Records the model name used for the response.
Parameters
- modelName string - The model identifier/name used to generate the response (for example:
gpt-40-2024)
addResponseId
Records the response identifier assigned by the provider.
addInputTokenCount
function addInputTokenCount(int count)Records the count of input tokens consumed by the request.
Parameters
- count int - Number of input tokens consumed
addOutputTokenCount
function addOutputTokenCount(int count)Records the count of output tokens produced by the model.
Parameters
- count int - Number of output tokens produced
addFinishReason
Records the finish reason(s) returned by the model.
Parameters
addOutputType
function addOutputType(OutputType outputType)Records the response output type
Parameters
- outputType OutputType - The output type describing the response format
addStopSequence
Records one or more stop sequences supplied to the model
addTools
function addTools(json[] tools)Records the tools schema send to the model
Parameters
- tools json[] - An array of tool schemas sent the the model
Import
import ballerina/ai.observe;Metadata
Released date: 7 days ago
Version: 1.8.0
License: Apache-2.0
Compatibility
Platform: java21
Ballerina version: 2201.12.0
GraalVM compatible: Yes
Pull count
Total: 138
Current verison: 0
Weekly downloads
Keywords
AI/Agent
Cost/Freemium
Agent
AI
Contributors