Metadata-Version: 2.3
Name: llm-taxi
Version: 0.6.1
Summary: Call LLM as easily as calling a taxi.
Author-email: Yevgnen Koh <wherejoystarts@gmail.com>
Requires-Python: >=3.10
Requires-Dist: anthropic>=0.30.1
Requires-Dist: google-generativeai>=0.7.1
Requires-Dist: groq>=0.9.0
Requires-Dist: httpx[socks]>=0.27.0
Requires-Dist: mistralai>=0.4.2
Requires-Dist: openai>=1.35.10
Requires-Dist: pydantic>=2.7.1
Requires-Dist: together>=1.2.1
Description-Content-Type: text/markdown

# llm-taxi

## Installation

```shell
pip install llm-taxi
```

## Usage

Use as a library

```python
import asyncio

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


async def main():
    # Non-streaming response
    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)

    # Streaming 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()

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

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



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

### Common parameters

- `temperature`
- `max_tokens`
- `top_k`
- `top_p`
- `stop`
- `seed`
- `presence_penalty`
- `frequency_penalty`
- `response_format`
- `tools`
- `tool_choice`

## Command line interface

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

See all supported arguments

```shell
llm-taxi --help
```

## Supported Providers

|  Provider  | LLM | Embedding |
| :--------: | :-: | :-------: |
| Anthropic  | ✅  |           |
| DashScope  | ✅  |           |
| DeepInfra  | ✅  |           |
|  DeepSeek  | ✅  |           |
|   Google   | ✅  |    ✅     |
|    Groq    | ✅  |           |
|  Mistral   | ✅  |    ✅     |
|   OpenAI   | ✅  |    ✅     |
| OpenRouter | ✅  |           |
| Perplexity | ✅  |           |
|  Together  | ✅  |           |
|  BigModel  | ✅  |           |
