Metadata-Version: 2.4
Name: ai_salom_x391
Version: 2.0.6
Summary: Multi-provider Uzbek-friendly AI chat CLI package
Author: ai_salom_x391 contributors
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: google-generativeai>=0.8.0
Requires-Dist: openai>=1.0.0
Requires-Dist: anthropic>=0.18.0
Requires-Dist: rich>=13.0.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: prompt-toolkit>=3.0.0
Requires-Dist: requests>=2.31.0
Requires-Dist: pydantic>=2.0.0
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# ai_salom_x391

`ai_salom_x391` is a Python package for a beautiful Uzbek-friendly AI chat CLI with automatic provider and model selection.

`ai_salom_x391` - API kalit formatiga qarab providerni avtomatik aniqlaydigan, chiroyli CLI interfeysli, o'zbek tiliga mos AI chat paketi.

## Features

- Google Gemini, OpenAI, Anthropic Claude, DeepSeek, and local Ollama support
- Automatic provider detection from API key format
- Automatic best-model selection
- Gemini default model: `gemini-2.0-flash`
- Default Uzbek ethical assistant system prompt
- Rich terminal UI with welcome panel, command table, spinner, markdown answers, prompt-toolkit input, chat history, export, stats
- Persistent chat history is loaded automatically on startup
- Retry logic, streaming support, token and approximate cost tracking
- Thread-safe JSON history helpers

## Installation

```bash
pip install .
```

For development:

```bash
pip install -r requirements.txt
pip install -e .
```

## Environment Variables

You can pass API keys directly or set:

```bash
GEMINI_API_KEY=...
OPENAI_API_KEY=...
ANTHROPIC_API_KEY=...
DEEPSEEK_API_KEY=...
OLLAMA_BASE_URL=http://localhost:11434
```

## Python Usage

Minimal usage:

```python
import ai_salom_x391

ai_salom_x391.run(API_KEY="user_api_key")
```

Full usage:

```python
ai_salom_x391.run(
    API_KEY="user_api_key",
    SYSTEM_PROMPT="Siz yordamchi AI...",
    MODEL="auto",
    PROVIDER="auto",
    TEMPERATURE=0.7,
    MAX_TOKENS=2048,
)
```

Beginner-friendly tuple style is also accepted:

```python
ai_salom_x391.run(
    API_KEY="AIza...",
    PROVIDER="gemini",
    MODEL=("MODEL", "gemini-3-flash-preview"),
)
```

Gemini:

```python
ai_salom_x391.run(API_KEY="AIza...")
```

OpenAI:

```python
ai_salom_x391.run(API_KEY="sk-...", PROVIDER="openai", MODEL="gpt-4")
```

Local Ollama:

```python
ai_salom_x391.run(PROVIDER="ollama", MODEL="llama3")
```

## CLI Usage

```bash
ai-salom --api-key "AIza..."
ai-salom --provider openai --model gpt-4 --api-key "sk-..."
ai-salom --provider ollama --model llama3
python -m ai_salom_x391 --provider ollama --model llama3
```

CLI commands:

```text
/help                 Help
/clear                Clear terminal
/model                Show current provider and model
/switch provider:X    Switch provider
/switch model:Y       Switch model
/history              Show conversation history
/export [md|json|txt] Export conversation
/stats                Show token and cost stats
/exit                 Exit
```

## O'zbekcha qo'llanma

O'rnatish:

```bash
pip install .
```

Ishlatish:

```python
import ai_salom_x391

ai_salom_x391.run(API_KEY="har_qanday_provider_api_kaliti")
```

Paket quyidagilarni avtomatik bajaradi:

- API key formatiga qarab providerni aniqlaydi
- Provider ichida eng yaxshi default modelni tanlaydi
- O'zbek tilidagi default system promptni yuboradi
- Chiroyli terminal chat interfeysini ochadi
- Suhbat tarixini saqlaydi va eksport qiladi

Ollama uchun API key kerak emas:

```python
ai_salom_x391.run(PROVIDER="ollama", MODEL="llama3")
```

## Tests

```bash
pytest
```

Integration tests are written with mocked provider calls, so they do not call paid APIs.
