Microsoft.Extensions.AI Integration
Cross-SDK comparison
See the centralized MEAI documentation for feature matrices and comparisons across all tryAGI SDKs.
The Opik SDK provides AIFunction tool wrappers compatible with Microsoft.Extensions.AI. These tools can be used with any IChatClient to give AI models access to Opik's LLM observability, trace management, and prompt versioning capabilities.
Available Tools
| Method | Tool Name | Description |
|---|---|---|
AsListProjectsTool() |
ListProjects |
Lists projects with optional name filtering. |
AsGetTraceTool() |
GetTrace |
Retrieves a trace by ID with name, times, and tags. |
AsListPromptsTool() |
ListPrompts |
Lists prompts with optional name filtering. |
AsCreateProjectTool() |
CreateProject |
Creates a new project for organizing traces. |
AsCreateTraceTool() |
CreateTrace |
Logs a new trace for an LLM operation. |
AsCreateSpanTool() |
CreateSpan |
Logs a span within a trace for a sub-operation. |
Usage
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | |
Tool Details
ListProjects
Lists projects with optional name filtering (partial match, case insensitive).
1 | |
GetTrace
Retrieves a trace by its ID, returning name, start/end times, and tags.
ListPrompts
Lists prompts with optional name filtering. Returns prompt metadata including template structure type, tags, and descriptions.
1 | |
CreateProject
Creates a new project for organizing traces and experiments. Accepts a required name and optional description.
CreateTrace
Logs a new trace for an LLM operation. Requires a name. Optionally specify a project name and comma-separated tags. Returns the generated trace ID.
CreateSpan
Logs a span within an existing trace for a sub-operation (e.g., an LLM call). Requires a trace ID and name. Optionally specify project name, model, and provider. Returns the generated span ID.