Skip to main content

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" # for OpenAI
# model_name="claude-3-haiku-20240307" # uncomment for Anthropic

# 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

Anthropic Models:

  • CLAUDE_3_OPUS_20240229 = "claude-3-opus-20240229"
  • CLAUDE_3_HAIKU_20240307 = "claude-3-haiku-20240307"
  • CLAUDE_3_5_SONNET_20240620 = "claude-3-5-sonnet-20240620"
  • CLAUDE_3_SONNET_20240229 = "claude-3-sonnet-20240229"

OpenAI Models:

  • GPT_3_5_TURBO_0125 = "gpt-3.5-turbo-0125"
  • GPT_3_5_TURBO = "gpt-3.5-turbo"
  • GPT_3_5_TURBO_INSTRUCT = "gpt-3.5-turbo-instruct"
  • GPT_4 = "gpt-4"
  • GPT_4O = "gpt-4o"
  • GPT_4O_2024_05_13 = "gpt-4o-2024-05-13"
  • DAVINCI = "davinci"
  • CURIE = "curie"

Testing

The package includes pytest-based tests for both OpenAI and Anthropic clients. To run the tests:

make test

Dependencies

  • instructor
  • anthropic (optional, for Anthropic models)
  • pydantic

Metadata

Release files for qrev-instructor 0.5.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qrev-instructor 0.5.8
File Size Uploaded Provenance Actions
qrev_instructor-0.5.8.tar.gz 4.7 kB Without provenance Details for qrev_instructor-0.5.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for qrev-instructor 0.5.8
File Interpreter ABI Platform Actions
qrev_instructor-0.5.8-py3-none-any.whl Python 3 none any Details for qrev_instructor-0.5.8-py3-none-any.whl

Total release size: 11.1 kB

Release files / qrev_instructor-0.5.8.tar.gz

Download URL qrev_instructor-0.5.8.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4012f0b4932a399d6c9a7a01ba3da714ce13ab9ed7d8f2585add0651d9b3deed
BLAKE2b-256 checksum
How to use checksums
f17145a74dbe0b4177d3b646bd3f77ab6758abab6c5047512cf5f84f69f3466d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.9 Darwin/23.0.0

Release files / qrev_instructor-0.5.8-py3-none-any.whl

Download URL qrev_instructor-0.5.8-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4880e8017371452563d70abe127cc3fd480ab7da44f3463b3e34bb8e7e56baf
BLAKE2b-256 checksum
How to use checksums
09c64cb4addf484a625d42b1fcf59ec007d4e52ff509cae2a30aacbd2324d165
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.9 Darwin/23.0.0

Security for qrev-instructor 0.5.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page