Skip to main content

Common interface for language models.

Project description

llm-providers

A common, minimal-dependency, async-first interface for interacting with Large Language Model provider APIs.

Getting Started

pip install llm-providers

from llm_providers.openai import OpenAIProvider

async def main():
  provider = OpenAIProvider(
      connection_str=os.environ.get("OPENAI_API_KEY"),
  )

  completion = await provider.complete(prompt="hey i'm a robot who")
  assert completion.prompt == "hey i'm a robot who"
  assert type(completion.completion_text) == str

if __name__ == "__main__":
    asyncio.run(main())

License

This project is licensed under the Apache License

Acknowledgments

Much code borrowed from https://github.com/HazyResearch/manifest

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

llm_providers-0.1.0.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

llm_providers-0.1.0-py2.py3-none-any.whl (11.1 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: llm_providers-0.1.0.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.1

File hashes

Hashes for llm_providers-0.1.0.tar.gz
Algorithm Hash digest
SHA256 41b345a6f9eac872fdf32003309c85a754eb652f8d2100b31d008b5b11a5dd5c
MD5 fc7eb747d7ef946f22ecd2d9d62dcfa3
BLAKE2b-256 4e954e692627466ad0890f64f93e66191f5effa7d3356058b45ef8d0c0429dbf

See more details on using hashes here.

File details

Details for the file llm_providers-0.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for llm_providers-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f73cf280985304866b9fdedb6d5fbf86b971c225bcd2138d20b82f4646bb7486
MD5 248b03303a439cd7513b1383882ae5fe
BLAKE2b-256 52865d1f3ee16019a7b8fcad93d4121b9b7641bb01c8c4907dc5a545f0d401e1

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