venice-ai 1.0.0__tar.gz

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 (30) hide show
  1. venice_ai-1.0.0/PKG-INFO +311 -0
  2. venice_ai-1.0.0/README.md +278 -0
  3. venice_ai-1.0.0/pyproject.toml +98 -0
  4. venice_ai-1.0.0/src/venice_ai/__init__.py +44 -0
  5. venice_ai-1.0.0/src/venice_ai/_async_client.py +1695 -0
  6. venice_ai-1.0.0/src/venice_ai/_client.py +1164 -0
  7. venice_ai-1.0.0/src/venice_ai/_constants.py +5 -0
  8. venice_ai-1.0.0/src/venice_ai/_resource.py +125 -0
  9. venice_ai-1.0.0/src/venice_ai/exceptions.py +477 -0
  10. venice_ai-1.0.0/src/venice_ai/resources/__init__.py +15 -0
  11. venice_ai-1.0.0/src/venice_ai/resources/api_keys.py +807 -0
  12. venice_ai-1.0.0/src/venice_ai/resources/audio.py +337 -0
  13. venice_ai-1.0.0/src/venice_ai/resources/billing.py +436 -0
  14. venice_ai-1.0.0/src/venice_ai/resources/characters.py +99 -0
  15. venice_ai-1.0.0/src/venice_ai/resources/chat/__init__.py +63 -0
  16. venice_ai-1.0.0/src/venice_ai/resources/chat/completions.py +655 -0
  17. venice_ai-1.0.0/src/venice_ai/resources/embeddings.py +321 -0
  18. venice_ai-1.0.0/src/venice_ai/resources/image.py +959 -0
  19. venice_ai-1.0.0/src/venice_ai/resources/models.py +301 -0
  20. venice_ai-1.0.0/src/venice_ai/streaming.py +197 -0
  21. venice_ai-1.0.0/src/venice_ai/types/__init__.py +96 -0
  22. venice_ai-1.0.0/src/venice_ai/types/api_keys.py +288 -0
  23. venice_ai-1.0.0/src/venice_ai/types/audio.py +130 -0
  24. venice_ai-1.0.0/src/venice_ai/types/billing.py +167 -0
  25. venice_ai-1.0.0/src/venice_ai/types/characters.py +45 -0
  26. venice_ai-1.0.0/src/venice_ai/types/chat.py +594 -0
  27. venice_ai-1.0.0/src/venice_ai/types/embeddings.py +108 -0
  28. venice_ai-1.0.0/src/venice_ai/types/image.py +267 -0
  29. venice_ai-1.0.0/src/venice_ai/types/models.py +240 -0
  30. venice_ai-1.0.0/src/venice_ai/utils.py +877 -0
@@ -0,0 +1,311 @@
1
+ Metadata-Version: 2.3
2
+ Name: venice-ai
3
+ Version: 1.0.0
4
+ Summary: A community-driven Python client library for interacting with the Venice.ai API, offering comprehensive access to its features.
5
+ License: MIT
6
+ Keywords: ai,api-client,venice,ml,machine-learning
7
+ Author: Community Contributors
8
+ Requires-Python: >=3.11,<4.0
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Provides-Extra: tokenizers
20
+ Requires-Dist: Pillow (>=11.2.1,<12.0.0)
21
+ Requires-Dist: beautifulsoup4 (>=4.13.4,<5.0.0)
22
+ Requires-Dist: httpx (>=0.28.0,<0.29.0)
23
+ Requires-Dist: numpy (>=2.2.0,<3.0.0)
24
+ Requires-Dist: pydantic (>=2.7.0,<3.0.0)
25
+ Requires-Dist: pypandoc (>=1.15,<2.0)
26
+ Requires-Dist: tiktoken (>=0.9.0)
27
+ Requires-Dist: typing_extensions (>=4.7.0,<5.0.0)
28
+ Project-URL: Documentation, https://docs.venice.ai/api-reference
29
+ Project-URL: Homepage, https://github.com/venice-ai/venice-ai-python
30
+ Project-URL: Repository, https://github.com/venice-ai/venice-ai-python
31
+ Description-Content-Type: text/markdown
32
+
33
+ # Venice AI Python Client
34
+
35
+ [![PyPI version](https://img.shields.io/pypi/v/venice-ai.svg)](https://pypi.org/project/venice-ai/)
36
+ [![CI Status](https://github.com/venice-ai/venice-ai-python/actions/workflows/python-package.yml/badge.svg)](https://github.com/venice-ai/venice-ai-python/actions/workflows/python-package.yml)
37
+ [![Coverage Status](https://img.shields.io/codecov/c/github/venice-ai/venice-ai-python.svg)](https://codecov.io/gh/venice-ai/venice-ai-python)
38
+ [![Downloads](https://static.pepy.tech/badge/venice-ai)](https://pepy.tech/project/venice-ai)
39
+ [![Downloads](https://static.pepy.tech/badge/venice-ai/month)](https://pepy.tech/project/venice-ai)
40
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
41
+ [![Python Versions](https://img.shields.io/pypi/pyversions/venice-ai.svg)](https://pypi.org/project/venice-ai/)
42
+
43
+ Developed to benchmark and explore the full capabilities of the Venice.ai API, the venice-ai Python package has evolved into a comprehensive client library for developers. This library provides convenient access to Venice.ai's powerful features, including chat completions, image generation, audio synthesis, embeddings, and more, with support for both synchronous and asynchronous operations.
44
+
45
+ ## Table of Contents
46
+
47
+ - [Features](#features)
48
+ - [Getting Started](#getting-started)
49
+ - [Prerequisites](#prerequisites)
50
+ - [Installation](#installation)
51
+ - [API Key Setup](#api-key-setup)
52
+ - [Usage](#usage)
53
+ - [Client Initialization](#client-initialization)
54
+ - [Chat Completions](#chat-completions)
55
+ - [Image Generation](#image-generation)
56
+ - [Showcase Application](#showcase-application)
57
+ - [Testing](#testing)
58
+ - [Documentation](#documentation)
59
+ - [Contributing](#contributing)
60
+ - [License](#license)
61
+
62
+ ## Features
63
+
64
+ - Intuitive Pythonic interface for all Venice.ai API endpoints.
65
+ - Support for both synchronous and asynchronous operations.
66
+ - Comprehensive model support for Chat, Image Generation, Embeddings, etc.
67
+ - Streaming capabilities for chat completions and audio.
68
+ - Built-in utilities for tasks like token estimation.
69
+ - Robust error handling and type-hinted for a better developer experience.
70
+ - Detailed API documentation generated with Sphinx.
71
+
72
+ ## Getting Started
73
+
74
+ ### Prerequisites
75
+
76
+ Python 3.11 or higher.
77
+
78
+ ### Installation
79
+
80
+ You can install the Venice AI client library from PyPI:
81
+
82
+ ```bash
83
+ pip install venice-ai
84
+ ```
85
+
86
+ Alternatively, to install the latest development version from source:
87
+
88
+ ```bash
89
+ git clone https://github.com/venice-ai/venice-ai-python.git
90
+ cd venice-ai-python
91
+ poetry install
92
+ ```
93
+
94
+ ### API Key Setup
95
+
96
+ To use the Venice AI API, you need an API key.
97
+
98
+ The client library expects the API key to be available as an environment variable:
99
+
100
+ ```bash
101
+ export VENICE_API_KEY="your_api_key_here"
102
+ ```
103
+
104
+ Alternatively, you can pass the API key directly when initializing the client, though using environment variables is recommended for security.
105
+
106
+ ## Usage
107
+
108
+ ### Client Initialization
109
+
110
+ Synchronous Client:
111
+
112
+ ```python
113
+ from venice_ai import VeniceClient
114
+
115
+ client = VeniceClient()
116
+ # If API key is not set as an environment variable:
117
+ # client = VeniceClient(api_key="your_api_key_here")
118
+ ```
119
+
120
+ Asynchronous Client:
121
+
122
+ ```python
123
+ import asyncio
124
+ from venice_ai import AsyncVeniceClient
125
+
126
+ async def main():
127
+ async_client = AsyncVeniceClient()
128
+ # If API key is not set as an environment variable:
129
+ # async_client = AsyncVeniceClient(api_key="your_api_key_here")
130
+
131
+ # Example: Asynchronous Chat Completion
132
+ try:
133
+ print("Attempting asynchronous chat completion...")
134
+ response = await async_client.chat.completions.create(
135
+ model="llama-3.2-3b", # Or your preferred model
136
+ messages=[{"role": "user", "content": "Hello asynchronously from Venice AI!"}]
137
+ )
138
+ if response.choices:
139
+ print("Async Chat Response:", response.choices[0].message.content)
140
+ else:
141
+ print("No response choices received.")
142
+ except Exception as e: # Catching a general exception for API or client errors
143
+ print(f"An unexpected error occurred during async chat: {e}")
144
+ finally:
145
+ print("Closing async client...")
146
+ await async_client.close()
147
+ print("Async client closed.")
148
+
149
+ if __name__ == "__main__":
150
+ asyncio.run(main())
151
+ ```
152
+
153
+ It's important to `await async_client.close()` when you're finished using the asynchronous client. This ensures that underlying HTTP resources and connections are properly released, preventing potential resource leaks in your application.
154
+
155
+ ### Chat Completions
156
+
157
+ Non-streaming example:
158
+
159
+ ```python
160
+ from venice_ai import VeniceClient
161
+
162
+ # Ensure VENICE_API_KEY is set in your environment,
163
+ # or initialize the client with client = VeniceClient(api_key="your_api_key_here")
164
+ client = VeniceClient()
165
+ response = client.chat.completions.create(
166
+ model="llama-3.2-3b", # Or your preferred model
167
+ messages=[
168
+ {"role": "user", "content": "Hello, how are you?"}
169
+ ]
170
+ )
171
+ print(response.choices[0].message.content)
172
+ ```
173
+
174
+ Streaming example:
175
+
176
+ ```python
177
+ from venice_ai import VeniceClient
178
+
179
+ client = VeniceClient()
180
+ stream = client.chat.completions.create(
181
+ model="llama-3.2-3b",
182
+ messages=[
183
+ {"role": "user", "content": "Tell me a short story."}
184
+ ],
185
+ stream=True
186
+ )
187
+ for chunk in stream:
188
+ if chunk.choices and chunk.choices[0].delta.content:
189
+ print(chunk.choices[0].delta.content, end="")
190
+ print()
191
+ ```
192
+
193
+ ### Image Generation
194
+
195
+ Example:
196
+
197
+ ```python
198
+ from venice_ai import VeniceClient
199
+ import base64
200
+ from PIL import Image
201
+ import io
202
+
203
+ client = VeniceClient()
204
+ response = client.image.generate(
205
+ model="venice-sd35", # Or your preferred image model
206
+ prompt="A futuristic cityscape at sunset",
207
+ width=1024,
208
+ height=1024
209
+ )
210
+ # Assuming response.images[0] contains base64 encoded image data
211
+ if response.images:
212
+ img_b64 = response.images[0]
213
+ img_bytes = base64.b64decode(img_b64)
214
+ # To display or save the image (e.g., using Pillow)
215
+ # pil_image = Image.open(io.BytesIO(img_bytes))
216
+ # pil_image.show()
217
+ # pil_image.save("generated_image.png")
218
+ print("Image generated successfully (first image data received).")
219
+ ```
220
+
221
+ <!--
222
+ ### Audio Transcription
223
+
224
+ Example of transcribing an audio file using the `whisper-1` model:
225
+
226
+ ```python
227
+ from venice_ai import VeniceClient
228
+ # Make sure you have an audio file (e.g., "my_audio.mp3") in the specified path.
229
+
230
+ client = VeniceClient()
231
+ try:
232
+ # Replace "path/to/your/my_audio.mp3" with the actual path to your audio file.
233
+ with open("path/to/your/my_audio.mp3", "rb") as audio_file:
234
+ transcription = client.audio.transcriptions.create(
235
+ model="whisper-1", # Or your preferred transcription model
236
+ file=audio_file
237
+ )
238
+ print("Transcription:")
239
+ print(transcription.text)
240
+ except FileNotFoundError:
241
+ print("Error: Audio file not found. Please update the path to your audio file.")
242
+ except Exception as e: # Catching a general exception for other potential API or client errors
243
+ print(f"An error occurred during transcription: {e}")
244
+ ```
245
+ -->
246
+
247
+ ### Embeddings Creation
248
+
249
+ Example of creating embeddings for a piece of text:
250
+
251
+ ```python
252
+ from venice_ai import VeniceClient
253
+
254
+ client = VeniceClient()
255
+ try:
256
+ response = client.embeddings.create(
257
+ model="text-embedding-ada-002", # Or your preferred embeddings model
258
+ input="The Venice AI Python client makes API interaction seamless."
259
+ )
260
+ # The response.data contains a list of embedding objects.
261
+ if response.data and response.data[0].embedding:
262
+ first_embedding_vector = response.data[0].embedding
263
+ print(f"Generated embedding vector (first 5 dimensions): {first_embedding_vector[:5]}")
264
+ print(f"Total dimensions of the vector: {len(first_embedding_vector)}")
265
+ else:
266
+ print("No embedding data received.")
267
+ except Exception as e: # Catching a general exception for API or client errors
268
+ print(f"An error occurred during embedding creation: {e}")
269
+ ```
270
+
271
+ For more detailed examples of other functionalities (Audio, Embeddings, Billing, API Keys, Characters), please refer to the [Showcase Application](#showcase-application) and the official [API Documentation](#documentation).
272
+
273
+ ## Showcase Application
274
+
275
+ This project includes a Streamlit application ([`app.py`](app.py)) that demonstrates various features of the `venice-ai` library.
276
+
277
+ To run the showcase application:
278
+
279
+ ```bash
280
+ # Ensure you have installed dev dependencies (including Streamlit):
281
+ # poetry install --with dev
282
+ poetry run streamlit run app.py
283
+ ```
284
+
285
+ ## Testing
286
+
287
+ The library includes a comprehensive test suite using `pytest`.
288
+
289
+ To run all tests (unit, E2E, benchmarks) and generate a coverage report:
290
+
291
+ ```bash
292
+ # Ensure dev dependencies are installed: poetry install --with dev
293
+ poetry run python test_runner.py --group all --coverage --html
294
+ ```
295
+
296
+ The test runner ([`test_runner.py`](test_runner.py)) also supports an interactive mode and options to run specific test groups or files. Run `poetry run python test_runner.py --help` for more options.
297
+
298
+ ## Documentation
299
+
300
+ Detailed API documentation for the Venice.ai API is available at: https://docs.venice.ai/api-reference
301
+
302
+ The documentation is generated using Sphinx from the docstrings within the codebase.
303
+
304
+ ## Contributing
305
+
306
+ Please feel free to open issues.
307
+
308
+ ## License
309
+
310
+ This project is licensed under the MIT License.
311
+
@@ -0,0 +1,278 @@
1
+ # Venice AI Python Client
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/venice-ai.svg)](https://pypi.org/project/venice-ai/)
4
+ [![CI Status](https://github.com/venice-ai/venice-ai-python/actions/workflows/python-package.yml/badge.svg)](https://github.com/venice-ai/venice-ai-python/actions/workflows/python-package.yml)
5
+ [![Coverage Status](https://img.shields.io/codecov/c/github/venice-ai/venice-ai-python.svg)](https://codecov.io/gh/venice-ai/venice-ai-python)
6
+ [![Downloads](https://static.pepy.tech/badge/venice-ai)](https://pepy.tech/project/venice-ai)
7
+ [![Downloads](https://static.pepy.tech/badge/venice-ai/month)](https://pepy.tech/project/venice-ai)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
+ [![Python Versions](https://img.shields.io/pypi/pyversions/venice-ai.svg)](https://pypi.org/project/venice-ai/)
10
+
11
+ Developed to benchmark and explore the full capabilities of the Venice.ai API, the venice-ai Python package has evolved into a comprehensive client library for developers. This library provides convenient access to Venice.ai's powerful features, including chat completions, image generation, audio synthesis, embeddings, and more, with support for both synchronous and asynchronous operations.
12
+
13
+ ## Table of Contents
14
+
15
+ - [Features](#features)
16
+ - [Getting Started](#getting-started)
17
+ - [Prerequisites](#prerequisites)
18
+ - [Installation](#installation)
19
+ - [API Key Setup](#api-key-setup)
20
+ - [Usage](#usage)
21
+ - [Client Initialization](#client-initialization)
22
+ - [Chat Completions](#chat-completions)
23
+ - [Image Generation](#image-generation)
24
+ - [Showcase Application](#showcase-application)
25
+ - [Testing](#testing)
26
+ - [Documentation](#documentation)
27
+ - [Contributing](#contributing)
28
+ - [License](#license)
29
+
30
+ ## Features
31
+
32
+ - Intuitive Pythonic interface for all Venice.ai API endpoints.
33
+ - Support for both synchronous and asynchronous operations.
34
+ - Comprehensive model support for Chat, Image Generation, Embeddings, etc.
35
+ - Streaming capabilities for chat completions and audio.
36
+ - Built-in utilities for tasks like token estimation.
37
+ - Robust error handling and type-hinted for a better developer experience.
38
+ - Detailed API documentation generated with Sphinx.
39
+
40
+ ## Getting Started
41
+
42
+ ### Prerequisites
43
+
44
+ Python 3.11 or higher.
45
+
46
+ ### Installation
47
+
48
+ You can install the Venice AI client library from PyPI:
49
+
50
+ ```bash
51
+ pip install venice-ai
52
+ ```
53
+
54
+ Alternatively, to install the latest development version from source:
55
+
56
+ ```bash
57
+ git clone https://github.com/venice-ai/venice-ai-python.git
58
+ cd venice-ai-python
59
+ poetry install
60
+ ```
61
+
62
+ ### API Key Setup
63
+
64
+ To use the Venice AI API, you need an API key.
65
+
66
+ The client library expects the API key to be available as an environment variable:
67
+
68
+ ```bash
69
+ export VENICE_API_KEY="your_api_key_here"
70
+ ```
71
+
72
+ Alternatively, you can pass the API key directly when initializing the client, though using environment variables is recommended for security.
73
+
74
+ ## Usage
75
+
76
+ ### Client Initialization
77
+
78
+ Synchronous Client:
79
+
80
+ ```python
81
+ from venice_ai import VeniceClient
82
+
83
+ client = VeniceClient()
84
+ # If API key is not set as an environment variable:
85
+ # client = VeniceClient(api_key="your_api_key_here")
86
+ ```
87
+
88
+ Asynchronous Client:
89
+
90
+ ```python
91
+ import asyncio
92
+ from venice_ai import AsyncVeniceClient
93
+
94
+ async def main():
95
+ async_client = AsyncVeniceClient()
96
+ # If API key is not set as an environment variable:
97
+ # async_client = AsyncVeniceClient(api_key="your_api_key_here")
98
+
99
+ # Example: Asynchronous Chat Completion
100
+ try:
101
+ print("Attempting asynchronous chat completion...")
102
+ response = await async_client.chat.completions.create(
103
+ model="llama-3.2-3b", # Or your preferred model
104
+ messages=[{"role": "user", "content": "Hello asynchronously from Venice AI!"}]
105
+ )
106
+ if response.choices:
107
+ print("Async Chat Response:", response.choices[0].message.content)
108
+ else:
109
+ print("No response choices received.")
110
+ except Exception as e: # Catching a general exception for API or client errors
111
+ print(f"An unexpected error occurred during async chat: {e}")
112
+ finally:
113
+ print("Closing async client...")
114
+ await async_client.close()
115
+ print("Async client closed.")
116
+
117
+ if __name__ == "__main__":
118
+ asyncio.run(main())
119
+ ```
120
+
121
+ It's important to `await async_client.close()` when you're finished using the asynchronous client. This ensures that underlying HTTP resources and connections are properly released, preventing potential resource leaks in your application.
122
+
123
+ ### Chat Completions
124
+
125
+ Non-streaming example:
126
+
127
+ ```python
128
+ from venice_ai import VeniceClient
129
+
130
+ # Ensure VENICE_API_KEY is set in your environment,
131
+ # or initialize the client with client = VeniceClient(api_key="your_api_key_here")
132
+ client = VeniceClient()
133
+ response = client.chat.completions.create(
134
+ model="llama-3.2-3b", # Or your preferred model
135
+ messages=[
136
+ {"role": "user", "content": "Hello, how are you?"}
137
+ ]
138
+ )
139
+ print(response.choices[0].message.content)
140
+ ```
141
+
142
+ Streaming example:
143
+
144
+ ```python
145
+ from venice_ai import VeniceClient
146
+
147
+ client = VeniceClient()
148
+ stream = client.chat.completions.create(
149
+ model="llama-3.2-3b",
150
+ messages=[
151
+ {"role": "user", "content": "Tell me a short story."}
152
+ ],
153
+ stream=True
154
+ )
155
+ for chunk in stream:
156
+ if chunk.choices and chunk.choices[0].delta.content:
157
+ print(chunk.choices[0].delta.content, end="")
158
+ print()
159
+ ```
160
+
161
+ ### Image Generation
162
+
163
+ Example:
164
+
165
+ ```python
166
+ from venice_ai import VeniceClient
167
+ import base64
168
+ from PIL import Image
169
+ import io
170
+
171
+ client = VeniceClient()
172
+ response = client.image.generate(
173
+ model="venice-sd35", # Or your preferred image model
174
+ prompt="A futuristic cityscape at sunset",
175
+ width=1024,
176
+ height=1024
177
+ )
178
+ # Assuming response.images[0] contains base64 encoded image data
179
+ if response.images:
180
+ img_b64 = response.images[0]
181
+ img_bytes = base64.b64decode(img_b64)
182
+ # To display or save the image (e.g., using Pillow)
183
+ # pil_image = Image.open(io.BytesIO(img_bytes))
184
+ # pil_image.show()
185
+ # pil_image.save("generated_image.png")
186
+ print("Image generated successfully (first image data received).")
187
+ ```
188
+
189
+ <!--
190
+ ### Audio Transcription
191
+
192
+ Example of transcribing an audio file using the `whisper-1` model:
193
+
194
+ ```python
195
+ from venice_ai import VeniceClient
196
+ # Make sure you have an audio file (e.g., "my_audio.mp3") in the specified path.
197
+
198
+ client = VeniceClient()
199
+ try:
200
+ # Replace "path/to/your/my_audio.mp3" with the actual path to your audio file.
201
+ with open("path/to/your/my_audio.mp3", "rb") as audio_file:
202
+ transcription = client.audio.transcriptions.create(
203
+ model="whisper-1", # Or your preferred transcription model
204
+ file=audio_file
205
+ )
206
+ print("Transcription:")
207
+ print(transcription.text)
208
+ except FileNotFoundError:
209
+ print("Error: Audio file not found. Please update the path to your audio file.")
210
+ except Exception as e: # Catching a general exception for other potential API or client errors
211
+ print(f"An error occurred during transcription: {e}")
212
+ ```
213
+ -->
214
+
215
+ ### Embeddings Creation
216
+
217
+ Example of creating embeddings for a piece of text:
218
+
219
+ ```python
220
+ from venice_ai import VeniceClient
221
+
222
+ client = VeniceClient()
223
+ try:
224
+ response = client.embeddings.create(
225
+ model="text-embedding-ada-002", # Or your preferred embeddings model
226
+ input="The Venice AI Python client makes API interaction seamless."
227
+ )
228
+ # The response.data contains a list of embedding objects.
229
+ if response.data and response.data[0].embedding:
230
+ first_embedding_vector = response.data[0].embedding
231
+ print(f"Generated embedding vector (first 5 dimensions): {first_embedding_vector[:5]}")
232
+ print(f"Total dimensions of the vector: {len(first_embedding_vector)}")
233
+ else:
234
+ print("No embedding data received.")
235
+ except Exception as e: # Catching a general exception for API or client errors
236
+ print(f"An error occurred during embedding creation: {e}")
237
+ ```
238
+
239
+ For more detailed examples of other functionalities (Audio, Embeddings, Billing, API Keys, Characters), please refer to the [Showcase Application](#showcase-application) and the official [API Documentation](#documentation).
240
+
241
+ ## Showcase Application
242
+
243
+ This project includes a Streamlit application ([`app.py`](app.py)) that demonstrates various features of the `venice-ai` library.
244
+
245
+ To run the showcase application:
246
+
247
+ ```bash
248
+ # Ensure you have installed dev dependencies (including Streamlit):
249
+ # poetry install --with dev
250
+ poetry run streamlit run app.py
251
+ ```
252
+
253
+ ## Testing
254
+
255
+ The library includes a comprehensive test suite using `pytest`.
256
+
257
+ To run all tests (unit, E2E, benchmarks) and generate a coverage report:
258
+
259
+ ```bash
260
+ # Ensure dev dependencies are installed: poetry install --with dev
261
+ poetry run python test_runner.py --group all --coverage --html
262
+ ```
263
+
264
+ The test runner ([`test_runner.py`](test_runner.py)) also supports an interactive mode and options to run specific test groups or files. Run `poetry run python test_runner.py --help` for more options.
265
+
266
+ ## Documentation
267
+
268
+ Detailed API documentation for the Venice.ai API is available at: https://docs.venice.ai/api-reference
269
+
270
+ The documentation is generated using Sphinx from the docstrings within the codebase.
271
+
272
+ ## Contributing
273
+
274
+ Please feel free to open issues.
275
+
276
+ ## License
277
+
278
+ This project is licensed under the MIT License.
@@ -0,0 +1,98 @@
1
+ [build-system]
2
+ requires = ["poetry-core>=1.0.0"]
3
+ build-backend = "poetry.core.masonry.api"
4
+
5
+ [tool.poetry]
6
+ name = "venice-ai"
7
+ version = "1.0.0"
8
+ description = "A community-driven Python client library for interacting with the Venice.ai API, offering comprehensive access to its features."
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ authors = [
12
+ "Community Contributors", # Update with actual team info
13
+ ]
14
+ keywords = ["ai", "api-client", "venice", "ml", "machine-learning"]
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3.10",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Operating System :: OS Independent",
22
+ "Intended Audience :: Developers",
23
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
24
+ "Topic :: Software Development :: Libraries :: Python Modules",
25
+ ]
26
+ packages = [{ include = "venice_ai", from = "src" }]
27
+
28
+ [tool.poetry.dependencies]
29
+ python = ">=3.11,<4.0"
30
+ httpx = "^0.28.0" # Using httpx for sync/async requests
31
+ typing_extensions = "^4.7.0" # For Literal, TypedDict etc. on older pythons
32
+ pydantic = "^2.7.0" # For data validation and serialization
33
+ numpy = "^2.2.0" # For numerical operations, required by some tests
34
+ tiktoken = ">=0.9.0" # For token estimation
35
+ Pillow = "^11.2.1" # For image processing (e.g., dimension checks)
36
+ pypandoc = "^1.15"
37
+ beautifulsoup4 = "^4.13.4"
38
+
39
+ [tool.poetry.urls]
40
+ Homepage = "https://github.com/venice-ai/venice-ai-python"
41
+ Repository = "https://github.com/venice-ai/venice-ai-python"
42
+ Documentation = "https://docs.venice.ai/api-reference"
43
+
44
+ [tool.poetry.group.dev.dependencies]
45
+ pytest-httpx = "^0.35.0"
46
+ pytest = "^8.3.5"
47
+ pytest-cov = "^6.1.1"
48
+ pytest-asyncio = "^1.0.0"
49
+ pytest-mock = "^3.14.0"
50
+ ruff = "^0.11.10"
51
+ black = "^25.1.0"
52
+ mypy = "^1.6.1"
53
+ sphinx = "^8.2.3"
54
+ sphinx-rtd-theme = "^3.0.2"
55
+ coverage = "^7.8.1"
56
+ questionary = "^2.0.1"
57
+ rich = "^14.0.0"
58
+ pytest-xdist = "^3.5.0"
59
+ typing_extensions = "^4.7.0"
60
+ furo = "^2024.8.6"
61
+
62
+ [tool.pytest.ini_options]
63
+ asyncio_mode = "auto"
64
+ asyncio_default_fixture_loop_scope = "function"
65
+ pythonpath = ["src"]
66
+ addopts = ""
67
+
68
+ [tool.coverage.run]
69
+ source = ["venice_ai"]
70
+ branch = true
71
+ parallel = false
72
+ # omit = [ "*/__main__.py" ] # Optional: if you have main scripts you want to omit
73
+
74
+ [tool.coverage.paths]
75
+ source = ["venice_ai", "src/venice_ai"]
76
+
77
+ [tool.coverage.report]
78
+ fail_under = 90 # Optional: Set a minimum coverage threshold
79
+ show_missing = true
80
+ skip_covered = true
81
+ exclude_lines = [
82
+ "pragma: no cover",
83
+ "def __repr__",
84
+ "if self.debug:",
85
+ "if settings.DEBUG",
86
+ "raise AssertionError",
87
+ "raise NotImplementedError",
88
+ "if 0:",
89
+ "if __name__ == .__main__.:",
90
+ "if TYPE_CHECKING:",
91
+ " pass", # Allow 'pass' on its own line if it's the only thing in a TYPE_CHECKING block
92
+ ]
93
+
94
+ [tool.poetry.extras]
95
+ tokenizers = []
96
+
97
+ [tool.poetry.scripts]
98
+ test-runner = "test_runner:main"