Skip to main content

Utilities for working with Large Language Models

Project description

RLHF-Utils

A Python package containing utilities for working with Large Language Models (LLMs).

Installation

pip install rlhf-utils

Features

  • Online Server Module: Utilities for making API calls to LLM providers
    • Parallel OpenAI API calls using multithreading
    • Progress tracking for batch API requests

Usage Examples

Parallel OpenAI API Calls

from rlhf_utils.online_server import multithread_openai_call
from openai import OpenAI

# Initialize OpenAI client
client = OpenAI(api_key="your-api-key")

# Define messages for multiple API calls
messages = [
    [{"role": "user", "content": "Explain quantum computing"}],
    [{"role": "user", "content": "Write a short poem about AI"}],
    [{"role": "user", "content": "Summarize the history of the internet"}]
]

# Make parallel API calls
responses = multithread_openai_call(
    client=client,
    messages=messages,
    model_name="gpt-3.5-turbo",
    max_workers=3
)

# Process responses
for i, response in enumerate(responses):
    print(f"Response {i+1}:\n{response}\n")

License

MIT

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

rlhf_utils-0.1.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rlhf_utils-0.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file rlhf_utils-0.1.0.tar.gz.

File metadata

  • Download URL: rlhf_utils-0.1.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for rlhf_utils-0.1.0.tar.gz
Algorithm Hash digest
SHA256 58154b3021cbe4213ace250a4fc70007ab31d6eef209853161bd284919fe3cf4
MD5 c44e24a57de100b9c763aa43676002a2
BLAKE2b-256 f69b20d6c4deedcb9381a45fa9a4fa49e0311a4fa008f9d7afd3d0a552a58169

See more details on using hashes here.

File details

Details for the file rlhf_utils-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: rlhf_utils-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for rlhf_utils-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f1251717d7a05951b5f2584d08f5f910abe56ce8af6aed39427a0d9c3e7f87a2
MD5 56470432ed782bbe43d8b567bcf1c980
BLAKE2b-256 29f4b228061685c1b6973a55af97dba501965c4d78b5913cbff050e15f97c5d4

See more details on using hashes here.

Supported by

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