Implementation:Open compass VLMEvalKit Claude Wrapper
| Field | Value |
|---|---|
| source | VLMEvalKit |
| domain | Vision, API_Integration |
Overview
Claude_Wrapper provides a VLMEvalKit API adapter for Anthropic Claude vision-language models.
Description
Claude_Wrapper inherits from BaseAPI and supports two backend configurations: the Alles proxy (via openxlab.org.cn) and the official Anthropic API. It handles image encoding to base64 with format detection, supports configurable temperature and max token parameters, and routes requests to the appropriate endpoint based on the selected backend. Authentication uses the ALLES or ANTHROPIC_API_KEY environment variables.
Usage
Use this adapter when evaluating Anthropic Claude models (such as claude-3-opus) through either the Alles proxy or the official Anthropic API.
Code Reference
- Source:
vlmeval/api/claude.py, Lines: L1-147 - Import:
from vlmeval.api.claude import Claude_Wrapper
Signature:
class Claude_Wrapper(BaseAPI):
def __init__(self, backend='alles', model='claude-3-opus-20240229',
key=None, retry=10, timeout=60, system_prompt=None,
verbose=True, temperature=0, max_tokens=2048,
**kwargs): ...
def generate_inner(self, inputs, **kwargs): ...
I/O Contract
| Direction | Description |
|---|---|
| Inputs | message — text/image/video content list; model-specific params via kwargs |
| Outputs | generate() returns str prediction; generate_inner() returns (int, str, str) tuple |
Usage Examples
# Example instantiation
model = Claude_Wrapper(model='claude-3-opus-20240229')
response = model.generate(message)