Skip to main content

A simple library for making requests to LLMs

Project description

LLMLib

LLMLib is a simple Python library for making requests to Language Learning Models (LLMs) such as OpenAI's GPT and Anthropic's Claude.

Installation

You can install LLMLib using pip:

pip install llmlib-amq

Usage

Here's a quick example of how to use LLMLib:

from llmlib import LLMClient, LLMRequest, Provider, OpenAIModel, Message

client = LLMClient(
    openai_api_key="your-openai-api-key",
    anthropic_api_key="your-anthropic-api-key"
)

request = LLMRequest(
    provider=Provider.OPENAI,
    model=OpenAIModel.GPT_3_5_TURBO,
    messages=[
        Message(role="system", content="You are a helpful assistant."),
        Message(role="user", content="Tell me a joke.")
    ],
    stream=True
)

for chunk in client.generate(request):
    print(chunk, end="", flush=True)

License

This project is licensed under the MIT License.

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

llmlib_amq-0.0.2.tar.gz (10.7 kB view hashes)

Uploaded Source

Built Distribution

llmlib_amq-0.0.2-py3-none-any.whl (5.6 kB view hashes)

Uploaded Python 3

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