Implementation:Evidentlyai Evidently SDK Adapters
| Knowledge Sources | |
|---|---|
| Domains | SDK, Adapters, Prompts, Configs, Artifacts |
| Last Updated | 2026-02-14 12:00 GMT |
Overview
Provides adapter classes that bridge between the Prompt, Config, and Artifact SDK interfaces, allowing one API abstraction to be used while delegating to a different underlying backend implementation.
Description
The SDK adapters module implements the Adapter design pattern to enable interoperability between different SDK interfaces (Prompts, Configs, Artifacts) and their backend implementations (OSS artifacts API, Cloud configs API). This is essential for supporting both the open-source self-hosted and cloud-hosted Evidently deployments with a unified SDK experience.
PromptArtifactAdapter: Implements the PromptAPI interface but delegates all operations to RemoteArtifactAPI. This allows using the prompt-oriented SDK interface against an OSS artifacts backend. It converts between RemoteArtifact/ArtifactVersion and RemotePrompt/PromptVersion models. Content is wrapped/unwrapped between PromptContent and ArtifactPromptContent.
ConfigArtifactAdapter: Implements the ConfigAPI interface but delegates to RemoteArtifactAPI. Similar to the prompt adapter, it converts between artifact and config models. It also provides typed helper methods for managing descriptors via add_descriptor() and get_descriptor().
ArtifactConfigAdapter: The reverse direction adapter. Implements the ArtifactAPI interface but delegates to CloudConfigAPI. This allows using the artifact-oriented SDK interface against a cloud configs backend. It converts between RemoteGenericConfig/ConfigVersion and RemoteArtifact/ArtifactVersion models.
Each adapter handles the full CRUD lifecycle: list, get, create, update, delete for both the parent entity and its versions, plus version bumping.
Usage
These adapters are used internally by workspace implementations to provide a consistent SDK interface regardless of the backend. PromptArtifactAdapter and ConfigArtifactAdapter are used in RemoteWorkspace (OSS) while ArtifactConfigAdapter is used in CloudWorkspace.
Code Reference
Source Location
- Repository: Evidentlyai_Evidently
- File:
src/evidently/sdk/adapters.py
Signature
class PromptArtifactAdapter(PromptAPI):
def __init__(self, workspace: "RemoteWorkspace"): ...
def list_prompts(self, project_id: STR_UUID) -> List[RemotePrompt]: ...
def get_or_create_prompt(self, project_id: STR_UUID, name: str) -> RemotePrompt: ...
def get_prompt(self, project_id: STR_UUID, name: str) -> RemotePrompt: ...
def get_prompt_by_id(self, project_id: STR_UUID, prompt_id: STR_UUID) -> RemotePrompt: ...
def create_prompt(self, project_id: STR_UUID, name: str) -> RemotePrompt: ...
def delete_prompt(self, prompt_id: STR_UUID): ...
def list_versions(self, prompt_id: STR_UUID) -> List[PromptVersion]: ...
def get_version(self, prompt_id: STR_UUID, version: VersionOrLatest) -> PromptVersion: ...
def create_version(self, prompt_id: STR_UUID, version: int, content: Any) -> PromptVersion: ...
def bump_prompt_version(self, prompt_id: STR_UUID, content: Any) -> PromptVersion: ...
class ConfigArtifactAdapter(ConfigAPI):
def __init__(self, workspace: "RemoteWorkspace"): ...
def list_configs(self, project_id: STR_UUID) -> List[RemoteGenericConfig]: ...
def get_or_create_config(self, project_id: STR_UUID, name: str) -> RemoteGenericConfig: ...
def add_descriptor(self, project_id: STR_UUID, name: str, descriptor): ...
def get_descriptor(self, project_id: STR_UUID, name: str, version: VersionOrLatest): ...
class ArtifactConfigAdapter(ArtifactAPI):
def __init__(self, workspace: "CloudWorkspace"): ...
def list_artifacts(self, project_id: STR_UUID) -> List[RemoteArtifact]: ...
def get_or_create_artifact(self, project_id: STR_UUID, name: str) -> RemoteArtifact: ...
def bump_artifact_version(self, artifact_id: STR_UUID, content: Any) -> ArtifactVersion: ...
Import
from evidently.sdk.adapters import PromptArtifactAdapter
from evidently.sdk.adapters import ConfigArtifactAdapter
from evidently.sdk.adapters import ArtifactConfigAdapter
I/O Contract
PromptArtifactAdapter
| Input | Type | Description |
|---|---|---|
| workspace | RemoteWorkspace |
OSS remote workspace for API calls |
| Method | Input | Output | Description |
|---|---|---|---|
| list_prompts | project_id: STR_UUID |
List[RemotePrompt] |
Lists all prompts (artifacts) in a project |
| get_or_create_prompt | project_id, name |
RemotePrompt |
Gets existing or creates new prompt |
| create_version | prompt_id, version, content |
PromptVersion |
Creates a new version, wrapping PromptContent in ArtifactPromptContent |
| bump_prompt_version | prompt_id, content |
PromptVersion |
Auto-increments version number |
ArtifactConfigAdapter
| Input | Type | Description |
|---|---|---|
| workspace | CloudWorkspace |
Cloud workspace for API calls |
| Method | Input | Output | Description |
|---|---|---|---|
| list_artifacts | project_id: STR_UUID |
List[RemoteArtifact] |
Lists all artifacts (configs) in a project |
| bump_artifact_version | artifact_id, content |
ArtifactVersion |
Auto-increments version number |
Usage Examples
from evidently.sdk.adapters import PromptArtifactAdapter
# Used internally by RemoteWorkspace to provide prompt API
adapter = PromptArtifactAdapter(workspace)
# List all prompts in a project
prompts = adapter.list_prompts(project_id)
# Get or create a prompt
prompt = adapter.get_or_create_prompt(project_id, "my-prompt")
# Create a new version
from evidently.llm.prompts.content import PromptContent
version = adapter.bump_prompt_version(prompt.id, prompt_content)