No project description provided
Project description
QRev Instructor
QRev Instructor is a Python wrapper around the instructor
module, providing a unified interface for working with different language models from OpenAI and Anthropic.
Features
- Supports both OpenAI and Anthropic models
- Easy-to-use client initialization
- Automatic model type detection
- Case-insensitive enum handling
- Extensible for other API types
Installation
To install QRev Instructor, use pip:
pip install qrev-instructor
For Anthropic (Claude models)
pip install qrev-instructor[anthropic]
Usage
Here's a basic example of how to use QRev Instructor:
from qrev_instructor import get_client
from pydantic import BaseModel
class User(BaseModel):
name: str
age: int
model_name="gpt-3.5-turbo"
# Initialize the client
client = get_client(model=model_name)
# Use the client to create a response
response = client.messages.create(
model=model_name,
messages=[
{
"role": "user",
"content": "Jason is 25 years old.",
}
],
response_model=User
)
print(f"Name: {response.name}, Age: {response.age}")
# prints "Name: Jason, Age: 25"
Supported Models
OpenAI Models:
- GPT-3.5-Turbo (various versions)
- GPT-4 (various versions)
- Davinci
- Curie
Anthropic Models:
- Claude-3-Opus
- Claude-3-Haiku
- Claude-3.5-Sonnet
Testing
The package includes pytest-based tests for both OpenAI and Anthropic clients. To run the tests:
pytest path/to/test_file.py
Dependencies
instructor
openai
(optional, for OpenAI models)anthropic
(optional, for Anthropic models)pydantic
License
[Your chosen license]
Contributing
[Your contribution guidelines]
Support
[Your support information]
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
qrev_instructor-0.5.0.tar.gz
(3.8 kB
view hashes)
Built Distribution
Close
Hashes for qrev_instructor-0.5.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f2a72811a9bbc36f9b918d61485b810efb9912b0e8fc81fc7243d1f578b1295 |
|
MD5 | 499df2940943a84736afa3303f9e9c56 |
|
BLAKE2b-256 | 21fa0d81f7add764a10260408c4dd5896cddbddc24f7c74c136a0aaa97e7b974 |