indoxrouter 0.1.2__py3-none-any.whl → 0.1.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. indoxrouter-0.1.3.dist-info/METADATA +188 -0
  2. indoxrouter-0.1.3.dist-info/RECORD +4 -0
  3. indoxrouter-0.1.3.dist-info/top_level.txt +1 -0
  4. indoxRouter/__init__.py +0 -83
  5. indoxRouter/client.py +0 -632
  6. indoxRouter/client_resourses/__init__.py +0 -20
  7. indoxRouter/client_resourses/base.py +0 -67
  8. indoxRouter/client_resourses/chat.py +0 -144
  9. indoxRouter/client_resourses/completion.py +0 -138
  10. indoxRouter/client_resourses/embedding.py +0 -83
  11. indoxRouter/client_resourses/image.py +0 -116
  12. indoxRouter/client_resourses/models.py +0 -114
  13. indoxRouter/config.py +0 -151
  14. indoxRouter/constants/__init__.py +0 -81
  15. indoxRouter/exceptions/__init__.py +0 -70
  16. indoxRouter/models/__init__.py +0 -111
  17. indoxRouter/providers/__init__.py +0 -108
  18. indoxRouter/providers/ai21labs.json +0 -128
  19. indoxRouter/providers/base_provider.py +0 -101
  20. indoxRouter/providers/claude.json +0 -164
  21. indoxRouter/providers/cohere.json +0 -116
  22. indoxRouter/providers/databricks.json +0 -110
  23. indoxRouter/providers/deepseek.json +0 -110
  24. indoxRouter/providers/google.json +0 -128
  25. indoxRouter/providers/meta.json +0 -128
  26. indoxRouter/providers/mistral.json +0 -146
  27. indoxRouter/providers/nvidia.json +0 -110
  28. indoxRouter/providers/openai.json +0 -308
  29. indoxRouter/providers/openai.py +0 -521
  30. indoxRouter/providers/qwen.json +0 -110
  31. indoxRouter/utils/__init__.py +0 -240
  32. indoxrouter-0.1.2.dist-info/LICENSE +0 -21
  33. indoxrouter-0.1.2.dist-info/METADATA +0 -259
  34. indoxrouter-0.1.2.dist-info/RECORD +0 -33
  35. indoxrouter-0.1.2.dist-info/top_level.txt +0 -1
  36. {indoxrouter-0.1.2.dist-info → indoxrouter-0.1.3.dist-info}/WHEEL +0 -0
@@ -0,0 +1,188 @@
1
+ Metadata-Version: 2.2
2
+ Name: indoxrouter
3
+ Version: 0.1.3
4
+ Summary: A unified client for various AI providers
5
+ Home-page: https://github.com/indoxrouter/indoxrouter
6
+ Author: indoxRouter Team
7
+ Author-email: ashkan.eskandari.dev@gmail.com
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.8
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Requires-Python: >=3.8
17
+ Description-Content-Type: text/markdown
18
+ Requires-Dist: requests>=2.25.0
19
+ Requires-Dist: python-dotenv>=1.0.0
20
+ Provides-Extra: dev
21
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
22
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
23
+ Requires-Dist: black>=23.0.0; extra == "dev"
24
+ Requires-Dist: isort>=5.0.0; extra == "dev"
25
+ Requires-Dist: flake8>=6.0.0; extra == "dev"
26
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
27
+ Dynamic: author
28
+ Dynamic: author-email
29
+ Dynamic: classifier
30
+ Dynamic: description
31
+ Dynamic: description-content-type
32
+ Dynamic: home-page
33
+ Dynamic: provides-extra
34
+ Dynamic: requires-dist
35
+ Dynamic: requires-python
36
+ Dynamic: summary
37
+
38
+ # IndoxRouter Client
39
+
40
+ A unified client for various AI providers, including OpenAI, Anthropic, Cohere, Google, and Mistral.
41
+
42
+ ## Features
43
+
44
+ - **Unified API**: Access multiple AI providers through a single API
45
+ - **Simple Interface**: Easy-to-use methods for chat, completion, embeddings, and image generation
46
+ - **Error Handling**: Standardized error handling across providers
47
+ - **Authentication**: Automatic token management
48
+
49
+ ## Installation
50
+
51
+ ```bash
52
+ pip install indoxrouter
53
+ ```
54
+
55
+ ## Usage
56
+
57
+ ### Initialization
58
+
59
+ ```python
60
+ from indoxrouter import Client
61
+
62
+ # Initialize with API key
63
+ client = Client(api_key="your_api_key", base_url="http://your-server-url:8000")
64
+
65
+ # Or initialize with username and password
66
+ client = Client(
67
+ username="your_username",
68
+ password="your_password",
69
+ base_url="http://your-server-url:8000"
70
+ )
71
+
72
+ # Using environment variables
73
+ # Set INDOXROUTER_API_KEY or INDOXROUTER_USERNAME and INDOXROUTER_PASSWORD
74
+ client = Client(base_url="http://your-server-url:8000")
75
+ ```
76
+
77
+ ### Chat Completions
78
+
79
+ ```python
80
+ response = client.chat(
81
+ messages=[
82
+ {"role": "system", "content": "You are a helpful assistant."},
83
+ {"role": "user", "content": "Tell me a joke."}
84
+ ],
85
+ provider="openai",
86
+ model="gpt-3.5-turbo",
87
+ temperature=0.7
88
+ )
89
+
90
+ print(response["choices"][0]["message"]["content"])
91
+ ```
92
+
93
+ ### Text Completions
94
+
95
+ ```python
96
+ response = client.completion(
97
+ prompt="Once upon a time,",
98
+ provider="openai",
99
+ model="gpt-3.5-turbo-instruct",
100
+ max_tokens=100
101
+ )
102
+
103
+ print(response["choices"][0]["text"])
104
+ ```
105
+
106
+ ### Embeddings
107
+
108
+ ```python
109
+ response = client.embeddings(
110
+ text=["Hello world", "AI is amazing"],
111
+ provider="openai",
112
+ model="text-embedding-ada-002"
113
+ )
114
+
115
+ print(f"Dimensions: {response['dimensions']}")
116
+ print(f"First embedding: {response['embeddings'][0][:5]}...")
117
+ ```
118
+
119
+ ### Image Generation
120
+
121
+ ```python
122
+ response = client.images(
123
+ prompt="A serene landscape with mountains and a lake",
124
+ provider="openai",
125
+ model="dall-e-3",
126
+ size="1024x1024"
127
+ )
128
+
129
+ print(f"Image URL: {response['images'][0]['url']}")
130
+ ```
131
+
132
+ ### Streaming Responses
133
+
134
+ ```python
135
+ for chunk in client.chat(
136
+ messages=[{"role": "user", "content": "Write a short story."}],
137
+ stream=True
138
+ ):
139
+ if "choices" in chunk and len(chunk["choices"]) > 0:
140
+ content = chunk["choices"][0].get("delta", {}).get("content", "")
141
+ print(content, end="", flush=True)
142
+ ```
143
+
144
+ ### Getting Available Models
145
+
146
+ ```python
147
+ # Get all providers and models
148
+ providers = client.models()
149
+ for provider in providers:
150
+ print(f"Provider: {provider['name']}")
151
+ for model in provider["models"]:
152
+ print(f" - {model['id']}: {model['name']}")
153
+
154
+ # Get models for a specific provider
155
+ openai_provider = client.models("openai")
156
+ print(f"OpenAI models: {[m['id'] for m in openai_provider['models']]}")
157
+ ```
158
+
159
+ ## Error Handling
160
+
161
+ ```python
162
+ from indoxrouter import Client, ModelNotFoundError, ProviderError
163
+
164
+ try:
165
+ client = Client(api_key="your_api_key", base_url="http://your-server-url:8000")
166
+ response = client.chat(
167
+ messages=[{"role": "user", "content": "Hello"}],
168
+ provider="nonexistent",
169
+ model="nonexistent-model"
170
+ )
171
+ except ModelNotFoundError as e:
172
+ print(f"Model not found: {e}")
173
+ except ProviderError as e:
174
+ print(f"Provider error: {e}")
175
+ ```
176
+
177
+ ## Context Manager
178
+
179
+ ```python
180
+ with Client(api_key="your_api_key", base_url="http://your-server-url:8000") as client:
181
+ response = client.chat([{"role": "user", "content": "Hello!"}])
182
+ print(response["choices"][0]["message"]["content"])
183
+ # Client is automatically closed when exiting the block
184
+ ```
185
+
186
+ ## License
187
+
188
+ This project is licensed under the MIT License - see the LICENSE file for details.
@@ -0,0 +1,4 @@
1
+ indoxrouter-0.1.3.dist-info/METADATA,sha256=7efp8b9jiVIK0-EnavBfiufhCNy-MdmW2tPvPRm7Isk,5122
2
+ indoxrouter-0.1.3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
3
+ indoxrouter-0.1.3.dist-info/top_level.txt,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
4
+ indoxrouter-0.1.3.dist-info/RECORD,,
@@ -0,0 +1 @@
1
+
indoxRouter/__init__.py DELETED
@@ -1,83 +0,0 @@
1
- """
2
- indoxRouter - A unified interface for various LLM providers.
3
-
4
- This package provides a simple and consistent way to interact with different
5
- LLM providers like OpenAI, Claude, Mistral, and more.
6
- """
7
-
8
- __version__ = "0.1.0"
9
-
10
- from .client import Client, IndoxRouter
11
- from .config import Config, get_config
12
- from .models import (
13
- ChatMessage,
14
- ChatResponse,
15
- CompletionResponse,
16
- EmbeddingResponse,
17
- ImageResponse,
18
- ModelInfo,
19
- Usage,
20
- )
21
- from .exceptions import (
22
- IndoxRouterError,
23
- AuthenticationError,
24
- ProviderError,
25
- ProviderNotFoundError,
26
- ModelNotFoundError,
27
- InvalidParametersError,
28
- RequestError,
29
- )
30
- from .constants import (
31
- DEFAULT_TEMPERATURE,
32
- DEFAULT_MAX_TOKENS,
33
- DEFAULT_TOP_P,
34
- DEFAULT_FREQUENCY_PENALTY,
35
- DEFAULT_PRESENCE_PENALTY,
36
- DEFAULT_IMAGE_SIZE,
37
- DEFAULT_IMAGE_COUNT,
38
- )
39
- from .utils import (
40
- count_tokens,
41
- calculate_cost,
42
- format_timestamp,
43
- )
44
-
45
- __all__ = [
46
- # Main client
47
- "Client",
48
- "IndoxRouter",
49
- # Configuration
50
- "Config",
51
- "get_config",
52
- # Database
53
- "Database",
54
- "get_database",
55
- # Models
56
- "ChatMessage",
57
- "ChatResponse",
58
- "CompletionResponse",
59
- "EmbeddingResponse",
60
- "ImageResponse",
61
- "ModelInfo",
62
- "Usage",
63
- # Exceptions
64
- "IndoxRouterError",
65
- "AuthenticationError",
66
- "ProviderError",
67
- "ProviderNotFoundError",
68
- "ModelNotFoundError",
69
- "InvalidParametersError",
70
- "RequestError",
71
- # Constants
72
- "DEFAULT_TEMPERATURE",
73
- "DEFAULT_MAX_TOKENS",
74
- "DEFAULT_TOP_P",
75
- "DEFAULT_FREQUENCY_PENALTY",
76
- "DEFAULT_PRESENCE_PENALTY",
77
- "DEFAULT_IMAGE_SIZE",
78
- "DEFAULT_IMAGE_COUNT",
79
- # Utilities
80
- "count_tokens",
81
- "calculate_cost",
82
- "format_timestamp",
83
- ]