components.Span
Span functionality for Components integration.
SpanConfig
Span config.
This class represents a span config.
SpanConfigDict
Span config dict.
This class represents a span config dictionary.
get_span_config_dict
Convert a span config to a span config dict else return the config.
Arguments:
Name | Description |
---|---|
config | The config to convert. |
Returns:
dict[str, Any]: The span config dict.
Span
Span.
This class represents a span.
__init__
Initialize a span.
Arguments:
Name | Description |
---|---|
config | The config to initialize the span with. |
writer | The writer to use. |
span
Add a span to this span.
Arguments:
Name | Description |
---|---|
config | The config to add the span to. |
input
Set the input for this span.
Arguments:
Name | Description |
---|---|
input | The input to set for this span. |
input_
Set the input for this span.
Arguments:
Name | Description |
---|---|
writer | The writer to use. |
span_id | The id of the span to set the input for. |
input | The input to set for this span. |
add_error
Add an error to this span.
Arguments:
Name | Description |
---|---|
config | The config to add the error to. |
Returns:
Name | Description |
---|---|
[Error](/sdk/python/references/models/prompt) | The error that was added. |
error_
Add an error to this span.
Arguments:
Name | Description |
---|---|
writer | The writer to use. |
span_id | The id of the span to add the error to. |
config | The config to add the error to. |
Returns:
Name | Description |
---|---|
[Error](/sdk/python/references/models/prompt) | The error that was added. |
span_
Add a span to this span.
Arguments:
Name | Description |
---|---|
writer | The writer to use. |
span_id | The id of the span to add the span to. |
config | The config to add the span to. |
Returns:
Name | Description |
---|---|
[Span](/sdk/python/references/logger/components/span) | The span that was added. |
generation
Add a generation to this span.
Arguments:
Name | Description |
---|---|
config | The config to add the generation to. |
Returns:
Name | Description |
---|---|
[Generation](/sdk/python/references/logger/components/generation) | The generation that was added. |
tool_call
Add a tool call to this span.
Arguments:
Name | Description |
---|---|
config | The config to add the tool call to. |
Returns:
Name | Description |
---|---|
[ToolCall](/sdk/python/references/models/prompt) | The tool call that was added. |
tool_call_
Add a tool call to this span.
Arguments:
Name | Description |
---|---|
writer | The writer to use. |
span_id | The id of the span to add the tool call to. |
config | The config to add the tool call to. |
Returns:
Name | Description |
---|---|
[ToolCall](/sdk/python/references/models/prompt) | The tool call that was added. |
generation_
Add a generation to this span.
Arguments:
Name | Description |
---|---|
writer | The writer to use. |
span_id | The id of the span to add the generation to. |
config | The config to add the generation to. |
Returns:
Name | Description |
---|---|
[Generation](/sdk/python/references/logger/components/generation) | The generation that was added. |
add_attachment
Add an attachment to this span.
Arguments:
Name | Description |
---|---|
attachment | The attachment to add. |
add_attachment_
Static method to add an attachment to a span.
Arguments:
Name | Description |
---|---|
writer | The LogWriter instance to use. |
span_id | The ID of the span to add the attachment to. |
attachment | The attachment to add. |
retrieval
Add a retrieval to this span.
Arguments:
Name | Description |
---|---|
config | The config to add the retrieval to. |
Returns:
Name | Description |
---|---|
[Retrieval](/sdk/python/references/logger/components/retrieval) | The retrieval that was added. |
retrieval_
Add a retrieval to this span.
Arguments:
Name | Description |
---|---|
writer | The writer to use. |
span_id | The id of the span to add the retrieval to. |
config | The config to add the retrieval to. |
Returns:
Name | Description |
---|---|
[Retrieval](/sdk/python/references/logger/components/retrieval) | The retrieval that was added. |
end_
End this span.
Arguments:
Name | Description |
---|---|
writer | The writer to use. |
span_id | The id of the span to end. |
data | The data to add to the span. |
add_tag_
Add a tag to this span.
Arguments:
Name | Description |
---|---|
writer | The writer to use. |
span_id | The id of the span to add the tag to. |
key | The key of the tag. |
value | The value of the tag. |
event_
Add an event to this span.
Arguments:
Name | Description |
---|---|
writer | The writer to use. |
span_id | The id of the span to add the event to. |
id | The id of the event. |
name | The name of the event. |
tags | The tags of the event. |
metadata | The metadata of the event. |