Skip to main content

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" # 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

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.5.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

qrev_instructor-0.5.5-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file qrev_instructor-0.5.5.tar.gz.

File metadata

  • Download URL: qrev_instructor-0.5.5.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.9 Darwin/23.0.0

File hashes

Hashes for qrev_instructor-0.5.5.tar.gz
Algorithm Hash digest
SHA256 a709ccc4f5803cd1d3ca8ae5e823fdf242601a87c838dec3b325b7f8d27f74df
MD5 b2dd8a0c9b2fe7c15985a5434def99e9
BLAKE2b-256 0cb98de77ccf03f3db7f9d400680d900902ede2cf329639c3717039e9d57d398

See more details on using hashes here.

File details

Details for the file qrev_instructor-0.5.5-py3-none-any.whl.

File metadata

  • Download URL: qrev_instructor-0.5.5-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.9 Darwin/23.0.0

File hashes

Hashes for qrev_instructor-0.5.5-py3-none-any.whl
Algorithm Hash digest
SHA256 097ee2d575d4db7c662439a927fe76d953003cec7276e4016736b5b1a175aa02
MD5 f0d9d995d5403408c9e9608cfaa3bd7c
BLAKE2b-256 0fea46bde49891eb7924d59ad1d05efc87739386b5028cb39ab353809a48a5d4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page