# openinference-instrumentation-pydantic-ai

**Python · Instrumentation**

OpenInference PydanticAI Instrumentation

- **Module**: `openinference.instrumentation.pydantic_ai`
- **Version**: 0.1.38
- **Python**: >=3.10, <3.16
- **Instruments**: `pydantic-ai>=2.24.0`

[PyPI](https://pypi.org/project/openinference-instrumentation-pydantic-ai/) · [README](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/README.md) · [Source](https://github.com/Arize-ai/openinference/tree/main/python/instrumentation/openinference-instrumentation-pydantic-ai)

## Install

```sh
pip install openinference-instrumentation-pydantic-ai
```

## `openinference.instrumentation.pydantic_ai`

### `OpenInferenceSpanProcessor`

_class_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/span_processor.py#L14-L82)

```python
class OpenInferenceSpanProcessor(
    span_filter: Optional[SpanFilter] = None,
)
```

Also importable from `openinference.instrumentation.pydantic_ai.span_processor`.

A standalone span processor that enhances spans with OpenInference attributes.

This processor processes spans by enhancing them with OpenInference attributes and can optionally filter which spans are processed based on a filter function. Unlike the Simple and Batch processors, this processor only modifies span attributes in-place without exporting them - it’s designed to work alongside other processors.

**Parameters**

| Name | Type | Default | Description |
| - | - | - | - |
| `span_filter` | `Optional[SpanFilter]` | `None` | Optional filter function to determine if a span should be processed |

**Example**

```python
from openinference.instrumentation.pydantic_ai import OpenInferenceSpanProcessor
from openinference.instrumentation.pydantic_ai.utils import is_openinference_span
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace.export import SimpleSpanProcessor

# Add the OpenInference processor to enhance spans
openinference_processor = OpenInferenceSpanProcessor(
    span_filter=is_openinference_span
)
tracer_provider.add_span_processor(openinference_processor)

# Add a separate exporter processor
exporter = OTLPSpanExporter()
export_processor = SimpleSpanProcessor(exporter)
tracer_provider.add_span_processor(export_processor)
```

#### `on_start`

_method_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/span_processor.py#L49-L51)

```python
def on_start(
    span: Span,
    parent_context: Optional[Context] = None,
) -> None
```

Called when a span starts. No processing needed at start.

#### `on_end`

_method_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/span_processor.py#L53-L74)

```python
def on_end(span: ReadableSpan) -> None
```

Process a span when it ends by enhancing it with OpenInference attributes.

#### `shutdown`

_method_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/span_processor.py#L76-L78)

```python
def shutdown() -> None
```

Shutdown the processor. No cleanup needed.

#### `force_flush`

_method_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/span_processor.py#L80-L82)

```python
def force_flush(timeout_millis: int = 30000) -> bool
```

Force flush any pending operations. Always returns True as there’s nothing to flush.

### `is_openinference_span`

_function_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/utils.py#L11-L15)

```python
def is_openinference_span(span: ReadableSpan) -> bool
```

Also importable from `openinference.instrumentation.pydantic_ai.utils`.

Check if a span is an OpenInference span.

## `openinference.instrumentation.pydantic_ai.utils`

### `should_export_span`

_function_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/utils.py#L18-L23)

```python
def should_export_span(
    span: ReadableSpan,
    span_filter: Optional[SpanFilter] = None,
) -> bool
```

Determine if a span should be exported based on a filter.

## `openinference.instrumentation.pydantic_ai.semantic_conventions`

### `OTELConventions`

_class_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/semantic_conventions.py#L71-L73)

```python
class OTELConventions
```

**Attributes**

| Name | Type and value |
| - | - |
| [`EVENTS`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.OTELConventions.EVENTS) | `'events'` |
| [`EVENT_NAME`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.OTELConventions.EVENT_NAME) | `'event.name'` |

### `GenAIConversationID`

_class_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/semantic_conventions.py#L76-L77)

```python
class GenAIConversationID
```

**Attributes**

| Name | Type and value |
| - | - |
| [`CONVERSATION_ID`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIConversationID.CONVERSATION_ID) | `'gen_ai.conversation.id'` |

### `GenAIEventNames`

_class_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/semantic_conventions.py#L80-L85)

```python
class GenAIEventNames
```

**Attributes**

| Name | Type and value |
| - | - |
| [`SYSTEM_MESSAGE`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIEventNames.SYSTEM_MESSAGE) | `'gen_ai.system.message'` |
| [`USER_MESSAGE`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIEventNames.USER_MESSAGE) | `'gen_ai.user.message'` |
| [`ASSISTANT_MESSAGE`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIEventNames.ASSISTANT_MESSAGE) | `'gen_ai.assistant.message'` |
| [`TOOL_MESSAGE`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIEventNames.TOOL_MESSAGE) | `'gen_ai.tool.message'` |
| [`CHOICE`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIEventNames.CHOICE) | `'gen_ai.choice'` |

### `GenAIMessageFields`

_class_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/semantic_conventions.py#L88-L93)

```python
class GenAIMessageFields
```

**Attributes**

| Name | Type and value |
| - | - |
| [`ID`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIMessageFields.ID) | `'id'` |
| [`CONTENT`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIMessageFields.CONTENT) | `'content'` |
| [`ROLE`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIMessageFields.ROLE) | `'role'` |
| [`PARTS`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIMessageFields.PARTS) | `'parts'` |
| [`TOOL_CALLS`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIMessageFields.TOOL_CALLS) | `'tool_calls'` |

### `GenAIMessageRoles`

_class_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/semantic_conventions.py#L96-L100)

```python
class GenAIMessageRoles
```

**Attributes**

| Name | Type and value |
| - | - |
| [`USER`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIMessageRoles.USER) | `'user'` |
| [`ASSISTANT`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIMessageRoles.ASSISTANT) | `'assistant'` |
| [`SYSTEM`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIMessageRoles.SYSTEM) | `'system'` |
| [`TOOL`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIMessageRoles.TOOL) | `'tool'` |

### `GenAIMessagePartFields`

_class_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/semantic_conventions.py#L103-L107)

```python
class GenAIMessagePartFields
```

**Attributes**

| Name | Type and value |
| - | - |
| [`TYPE`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIMessagePartFields.TYPE) | `'type'` |
| [`CONTENT`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIMessagePartFields.CONTENT) | `'content'` |
| [`RESULT`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIMessagePartFields.RESULT) | `'result'` |
| [`NAME`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIMessagePartFields.NAME) | `'name'` |

### `GenAIMessagePartTypes`

_class_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/semantic_conventions.py#L110-L113)

```python
class GenAIMessagePartTypes
```

**Attributes**

| Name | Type and value |
| - | - |
| [`TEXT`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIMessagePartTypes.TEXT) | `'text'` |
| [`TOOL_CALL`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIMessagePartTypes.TOOL_CALL) | `'tool_call'` |
| [`TOOL_CALL_RESPONSE`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIMessagePartTypes.TOOL_CALL_RESPONSE) | `'tool_call_response'` |

### `GenAIToolCallFields`

_class_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/semantic_conventions.py#L116-L119)

```python
class GenAIToolCallFields
```

**Attributes**

| Name | Type and value |
| - | - |
| [`FUNCTION`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIToolCallFields.FUNCTION) | `'function'` |
| [`ID`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIToolCallFields.ID) | `'id'` |
| [`TYPE`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIToolCallFields.TYPE) | `'type'` |

### `GenAIFunctionFields`

_class_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/semantic_conventions.py#L122-L124)

```python
class GenAIFunctionFields
```

**Attributes**

| Name | Type and value |
| - | - |
| [`NAME`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIFunctionFields.NAME) | `'name'` |
| [`ARGUMENTS`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIFunctionFields.ARGUMENTS) | `'arguments'` |

### `GenAIChoiceBodyFields`

_class_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/semantic_conventions.py#L127-L131)

```python
class GenAIChoiceBodyFields
```

**Attributes**

| Name | Type and value |
| - | - |
| [`INDEX`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIChoiceBodyFields.INDEX) | `'index'` |
| [`FINISH_REASON`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIChoiceBodyFields.FINISH_REASON) | `'finish_reason'` |
| [`MESSAGE`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIChoiceBodyFields.MESSAGE) | `'message'` |
| [`TOOL_CALLS`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAIChoiceBodyFields.TOOL_CALLS) | `'tool_calls'` |

### `GenAISystemInstructionsFields`

_class_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/semantic_conventions.py#L134-L136)

```python
class GenAISystemInstructionsFields
```

**Attributes**

| Name | Type and value |
| - | - |
| [`TYPE`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAISystemInstructionsFields.TYPE) | `'type'` |
| [`CONTENT`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.GenAISystemInstructionsFields.CONTENT) | `'content'` |

### `PydanticAgentName`

_class_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/semantic_conventions.py#L140-L141)

```python
class PydanticAgentName
```

**Attributes**

| Name | Type and value |
| - | - |
| [`AGENT`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.PydanticAgentName.AGENT) | `'agent_name'` |

### `PydanticTools`

_class_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/semantic_conventions.py#L144-L147)

```python
class PydanticTools
```

**Attributes**

| Name | Type and value |
| - | - |
| [`TOOLS`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.PydanticTools.TOOLS) | `'tools'` |
| [`TOOL_ARGUMENTS`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.PydanticTools.TOOL_ARGUMENTS) | `'tool_arguments'` |
| [`TOOL_RESPONSE`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.PydanticTools.TOOL_RESPONSE) | `'tool_response'` |

### `PydanticGenAIAttribute`

_class_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/semantic_conventions.py#L150-L151)

```python
class PydanticGenAIAttribute
```

**Attributes**

| Name | Type and value |
| - | - |
| [`GEN_AI`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.PydanticGenAIAttribute.GEN_AI) | `'gen_ai'` |

### `PydanticGenAITool`

_class_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/semantic_conventions.py#L157-L158)

```python
class PydanticGenAITool
```

**Attributes**

| Name | Type and value |
| - | - |
| [`TOOL`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.PydanticGenAITool.TOOL) | `'tool'` |

### `PydanticCustomAttributes`

_class_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/semantic_conventions.py#L161-L162)

```python
class PydanticCustomAttributes
```

**Attributes**

| Name | Type and value |
| - | - |
| [`MODEL_REQUEST_PARAMETERS`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.PydanticCustomAttributes.MODEL_REQUEST_PARAMETERS) | `'model_request_parameters'` |

### `PydanticModelRequestParameters`

_class_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/semantic_conventions.py#L165-L170)

```python
class PydanticModelRequestParameters
```

**Attributes**

| Name | Type and value |
| - | - |
| [`TOOLS`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.PydanticModelRequestParameters.TOOLS) | `'output_tools'` |
| [`FUNCTION_TOOLS`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.PydanticModelRequestParameters.FUNCTION_TOOLS) | `'function_tools'` |
| [`NAME`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.PydanticModelRequestParameters.NAME) | `'name'` |
| [`DESCRIPTION`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.PydanticModelRequestParameters.DESCRIPTION) | `'description'` |
| [`PARAMETERS`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.PydanticModelRequestParameters.PARAMETERS) | `'parameters'` |

### `PydanticModelRequestParametersTool`

_class_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/semantic_conventions.py#L173-L180)

```python
class PydanticModelRequestParametersTool
```

**Attributes**

| Name | Type and value |
| - | - |
| [`NAME`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.PydanticModelRequestParametersTool.NAME) | `'name'` |
| [`DESCRIPTION`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.PydanticModelRequestParametersTool.DESCRIPTION) | `'description'` |
| [`PARAMETERS_JSON_SCHEMA`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.PydanticModelRequestParametersTool.PARAMETERS_JSON_SCHEMA) | `'parameters_json_schema'` |
| [`PARAMETERS`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.PydanticModelRequestParametersTool.PARAMETERS) | `'properties'` |

### `PydanticMessageRoleUser`

_class_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/semantic_conventions.py#L183-L184)

```python
class PydanticMessageRoleUser
```

**Attributes**

| Name | Type and value |
| - | - |
| [`USER`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.PydanticMessageRoleUser.USER) | `'user'` |

### `PydanticFinalResult`

_class_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/semantic_conventions.py#L187-L188)

```python
class PydanticFinalResult
```

**Attributes**

| Name | Type and value |
| - | - |
| [`FINAL_RESULT`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.PydanticFinalResult.FINAL_RESULT) | `'final_result'` |

### `PydanticAllMessagesEvents`

_class_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/semantic_conventions.py#L191-L192)

```python
class PydanticAllMessagesEvents
```

**Attributes**

| Name | Type and value |
| - | - |
| [`ALL_MESSAGES_EVENTS`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.PydanticAllMessagesEvents.ALL_MESSAGES_EVENTS) | `'all_messages_events'` |

### `PydanticAllMessages`

_class_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/semantic_conventions.py#L195-L196)

```python
class PydanticAllMessages
```

**Attributes**

| Name | Type and value |
| - | - |
| [`ALL_MESSAGES`](https://openinf.dev/python/openinference-instrumentation-pydantic-ai.html.md#openinference.instrumentation.pydantic_ai.semantic_conventions.PydanticAllMessages.ALL_MESSAGES) | `'pydantic_ai.all_messages'` |

### `get_attributes`

_function_ · [Source](https://github.com/Arize-ai/openinference/blob/main/python/instrumentation/openinference-instrumentation-pydantic-ai/src/openinference/instrumentation/pydantic_ai/semantic_conventions.py#L268-L281)

```python
def get_attributes(
    gen_ai_attrs: Mapping[str, Any],
) -> Iterator[Tuple[str, Any]]
```

Main function to extract OpenInference attributes from GenAI attributes.

**Parameters**

| Name | Type | Description |
| - | - | - |
| `gen_ai_attrs` | `Mapping[str, Any]` | Dictionary with OTEL GenAI semantic convention attributes |

**Returns**

| Type | Description |
| - | - |
| `Iterator[Tuple[str, Any]]` | Iterator of (key, value) pairs for OpenInference attributes |
