Skip to main content

Call LLM as easily as calling a taxi.

Project description

llm-taxi

Installation

pip install llm-taxi

Usage

Use as a library

import asyncio

from llm_taxi.conversation import Message, Role
from llm_taxi.factory import embedding, llm


async def main():
    client = llm(model="openai:gpt-3.5-turbo")
    messages = [
        Message(role=Role.User, content="What is the capital of France?"),
    ]

    response = await client.response(messages)
    print(response)

    client = llm(model="mistral:mistral-small")
    messages = [
        Message(role=Role.User, content="Tell me a joke."),
    ]
    response = await client.streaming_response(messages)
    async for chunk in response:
        print(chunk, end="", flush=True)
    print()

    embedder = embedding("openai:text-embedding-ada-002")
    embeddings = await embedder.embed_text("Hello, world!")
    print(embeddings[:10])

    embedder = embedding("mistral:mistral-embed")
    embeddings = await embedder.embed_texts(["Hello, world!"])
    print(embeddings[0][:10])



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

Command line interface

llm-taxi --model openai:gpt-3.5-turbo-16k

See all supported arguments

llm-taxi --help

Supported Providers

Provider LLM Embedding
Anthropic
DashScope
DeepInfra
DeepSeek
Google
Groq
Mistral
OpenAI
OpenRouter
Perplexity
Together

Embeddings

  • Google
  • Mistral
  • OpenAI

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_taxi-0.3.3.tar.gz (10.1 kB view hashes)

Uploaded Source

Built Distribution

llm_taxi-0.3.3-py3-none-any.whl (19.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