askai-python 0.2.1__tar.gz → 0.3.3__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 (28) hide show
  1. {askai_python-0.2.1 → askai_python-0.3.3}/PKG-INFO +9 -1
  2. {askai_python-0.2.1 → askai_python-0.3.3}/README.md +15 -0
  3. {askai_python-0.2.1 → askai_python-0.3.3}/ask_ai/base.py +11 -0
  4. askai_python-0.3.3/ask_ai/requirements.txt +5 -0
  5. {askai_python-0.2.1 → askai_python-0.3.3}/askai_python.egg-info/PKG-INFO +9 -1
  6. {askai_python-0.2.1 → askai_python-0.3.3}/askai_python.egg-info/SOURCES.txt +1 -0
  7. {askai_python-0.2.1 → askai_python-0.3.3}/docs/PYPI_README.md +8 -0
  8. {askai_python-0.2.1 → askai_python-0.3.3}/pyproject.toml +8 -1
  9. {askai_python-0.2.1 → askai_python-0.3.3}/tests/test_core.py +1 -2
  10. {askai_python-0.2.1 → askai_python-0.3.3}/LICENSE +0 -0
  11. {askai_python-0.2.1 → askai_python-0.3.3}/ask_ai/__init__.py +0 -0
  12. {askai_python-0.2.1 → askai_python-0.3.3}/ask_ai/__main__.py +0 -0
  13. {askai_python-0.2.1 → askai_python-0.3.3}/ask_ai/cli.py +0 -0
  14. {askai_python-0.2.1 → askai_python-0.3.3}/ask_ai/config.py +0 -0
  15. {askai_python-0.2.1 → askai_python-0.3.3}/ask_ai/exceptions.py +0 -0
  16. {askai_python-0.2.1 → askai_python-0.3.3}/ask_ai/media.py +0 -0
  17. {askai_python-0.2.1 → askai_python-0.3.3}/ask_ai/providers/__init__.py +0 -0
  18. {askai_python-0.2.1 → askai_python-0.3.3}/ask_ai/providers/anthropic_provider.py +0 -0
  19. {askai_python-0.2.1 → askai_python-0.3.3}/ask_ai/providers/azure_provider.py +0 -0
  20. {askai_python-0.2.1 → askai_python-0.3.3}/ask_ai/providers/google_provider.py +0 -0
  21. {askai_python-0.2.1 → askai_python-0.3.3}/ask_ai/providers/groq_provider.py +0 -0
  22. {askai_python-0.2.1 → askai_python-0.3.3}/ask_ai/providers/openai_provider.py +0 -0
  23. {askai_python-0.2.1 → askai_python-0.3.3}/ask_ai/providers/openrouter_provider.py +0 -0
  24. {askai_python-0.2.1 → askai_python-0.3.3}/ask_ai/utils.py +0 -0
  25. {askai_python-0.2.1 → askai_python-0.3.3}/askai_python.egg-info/dependency_links.txt +0 -0
  26. {askai_python-0.2.1 → askai_python-0.3.3}/askai_python.egg-info/requires.txt +0 -0
  27. {askai_python-0.2.1 → askai_python-0.3.3}/askai_python.egg-info/top_level.txt +0 -0
  28. {askai_python-0.2.1 → askai_python-0.3.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: askai-python
3
- Version: 0.2.1
3
+ Version: 0.3.3
4
4
  Summary: AI Made Stupid Simple. Unified API for OpenAI, Groq, Google, and more.
5
5
  Author-email: Hossein Ghorbani <hosseingh1068@gmail.com>
6
6
  License: MIT
@@ -66,6 +66,10 @@ It does one thing perfectly: **Simplifying the API call to LLMs.**
66
66
  ## 🛠️ Advanced Usage
67
67
 
68
68
  ### 🧰 Developer QoL Utilities (Auto-Parsing)
69
+
70
+ <p align="center">
71
+ <img src="https://raw.githubusercontent.com/Hosseinghorbani0/ask-ai/main/assets/features.svg" alt="ask-ai features parsing banner" width="100%">
72
+ </p>
69
73
  Stop writing Regex to clean up model outputs! `ask-ai` comes with built-in text processing flags:
70
74
 
71
75
  ```python
@@ -92,6 +96,10 @@ print(data_dict['name'])
92
96
 
93
97
  ## 🚀 Built-in Resiliency (Retries & Timeouts)
94
98
 
99
+ <p align="center">
100
+ <img src="https://raw.githubusercontent.com/Hosseinghorbani0/ask-ai/main/assets/resiliency.svg" alt="ask-ai resiliency banner" width="100%">
101
+ </p>
102
+
95
103
  Build reliable apps without writing your own loops. `askai-python` handles rate limits (`429`) and network drops via an internal exponential backoff.
96
104
 
97
105
  ```python
@@ -12,6 +12,11 @@
12
12
  <a href="docs/README_ja.md"><img src="https://flagcdn.com/20x15/jp.png" alt="Japanese"> 日本語</a>
13
13
  </p>
14
14
 
15
+
16
+ <p align="center">
17
+ <img src="assets/banner.svg" alt="ask-ai animated banner" width="100%">
18
+ </p>
19
+
15
20
  <p align="center">
16
21
  <b>A minimal Python SDK to switch between LLM providers in one line.</b><br/>
17
22
  No frameworks. No servers. No overengineering.
@@ -21,6 +26,8 @@
21
26
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
22
27
  [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
23
28
 
29
+
30
+
24
31
  ---
25
32
 
26
33
  ## ⚡ Quick Start (5 seconds)
@@ -61,6 +68,10 @@ It does one thing perfectly: **Simplifying the API call to LLMs.**
61
68
  ## 🛠️ Advanced Usage
62
69
 
63
70
  ### 🧰 Developer QoL Utilities (Auto-Parsing)
71
+
72
+ <p align="center">
73
+ <img src="assets/features.svg" alt="ask-ai features parsing banner" width="100%">
74
+ </p>
64
75
  Stop writing Regex to clean up model outputs! `ask-ai` comes with built-in text processing flags:
65
76
 
66
77
  ```python
@@ -86,6 +97,10 @@ print(data_dict['name'])
86
97
  ```
87
98
 
88
99
  ### 🔄 Built-in Retries & Timeout (Resiliency)
100
+
101
+ <p align="center">
102
+ <img src="assets/resiliency.svg" alt="ask-ai resiliency banner" width="100%">
103
+ </p>
89
104
  Handle rate limits (`429`) and network drops automatically:
90
105
 
91
106
  ```python
@@ -136,6 +136,17 @@ class BaseProvider:
136
136
  from .exceptions import AskAINetworkError
137
137
  raise AskAINetworkError(f"Request failed after {retry} retries. Last error: {last_error}")
138
138
 
139
+ async def ask_async(self, query: str, **kwargs) -> Response:
140
+ """
141
+ Asynchronous wrapper for the .ask() method.
142
+ Perfect for Telegram bots (Aiogram) and FastAPI.
143
+ """
144
+ import asyncio
145
+ loop = asyncio.get_event_loop()
146
+ def _sync_ask():
147
+ return self.ask(query, **kwargs)
148
+ return await loop.run_in_executor(None, _sync_ask)
149
+
139
150
  def _is_retryable_error(self, e: Exception) -> bool:
140
151
  """Dynamically detect rate limits and network timeouts across different provider SDKs."""
141
152
  err_str = str(e).lower()
@@ -0,0 +1,5 @@
1
+ openai>=1.0.0
2
+ groq
3
+ google-generativeai
4
+ anthropic
5
+ requests
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: askai-python
3
- Version: 0.2.1
3
+ Version: 0.3.3
4
4
  Summary: AI Made Stupid Simple. Unified API for OpenAI, Groq, Google, and more.
5
5
  Author-email: Hossein Ghorbani <hosseingh1068@gmail.com>
6
6
  License: MIT
@@ -66,6 +66,10 @@ It does one thing perfectly: **Simplifying the API call to LLMs.**
66
66
  ## 🛠️ Advanced Usage
67
67
 
68
68
  ### 🧰 Developer QoL Utilities (Auto-Parsing)
69
+
70
+ <p align="center">
71
+ <img src="https://raw.githubusercontent.com/Hosseinghorbani0/ask-ai/main/assets/features.svg" alt="ask-ai features parsing banner" width="100%">
72
+ </p>
69
73
  Stop writing Regex to clean up model outputs! `ask-ai` comes with built-in text processing flags:
70
74
 
71
75
  ```python
@@ -92,6 +96,10 @@ print(data_dict['name'])
92
96
 
93
97
  ## 🚀 Built-in Resiliency (Retries & Timeouts)
94
98
 
99
+ <p align="center">
100
+ <img src="https://raw.githubusercontent.com/Hosseinghorbani0/ask-ai/main/assets/resiliency.svg" alt="ask-ai resiliency banner" width="100%">
101
+ </p>
102
+
95
103
  Build reliable apps without writing your own loops. `askai-python` handles rate limits (`429`) and network drops via an internal exponential backoff.
96
104
 
97
105
  ```python
@@ -8,6 +8,7 @@ ask_ai/cli.py
8
8
  ask_ai/config.py
9
9
  ask_ai/exceptions.py
10
10
  ask_ai/media.py
11
+ ask_ai/requirements.txt
11
12
  ask_ai/utils.py
12
13
  ask_ai/providers/__init__.py
13
14
  ask_ai/providers/anthropic_provider.py
@@ -47,6 +47,10 @@ It does one thing perfectly: **Simplifying the API call to LLMs.**
47
47
  ## 🛠️ Advanced Usage
48
48
 
49
49
  ### 🧰 Developer QoL Utilities (Auto-Parsing)
50
+
51
+ <p align="center">
52
+ <img src="https://raw.githubusercontent.com/Hosseinghorbani0/ask-ai/main/assets/features.svg" alt="ask-ai features parsing banner" width="100%">
53
+ </p>
50
54
  Stop writing Regex to clean up model outputs! `ask-ai` comes with built-in text processing flags:
51
55
 
52
56
  ```python
@@ -73,6 +77,10 @@ print(data_dict['name'])
73
77
 
74
78
  ## 🚀 Built-in Resiliency (Retries & Timeouts)
75
79
 
80
+ <p align="center">
81
+ <img src="https://raw.githubusercontent.com/Hosseinghorbani0/ask-ai/main/assets/resiliency.svg" alt="ask-ai resiliency banner" width="100%">
82
+ </p>
83
+
76
84
  Build reliable apps without writing your own loops. `askai-python` handles rate limits (`429`) and network drops via an internal exponential backoff.
77
85
 
78
86
  ```python
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "askai-python"
7
- version = "0.2.1"
7
+ version = "0.3.3"
8
8
  description = "AI Made Stupid Simple. Unified API for OpenAI, Groq, Google, and more."
9
9
  readme = "docs/PYPI_README.md"
10
10
  requires-python = ">=3.8"
@@ -24,3 +24,10 @@ dependencies = [
24
24
  [project.urls]
25
25
  "Homepage" = "https://hosseinghorbani0.ir/"
26
26
  "Bug Tracker" = "https://github.com/Hosseinghorbani0/ask-ai/issues"
27
+
28
+ [tool.setuptools.packages.find]
29
+ include = ["ask_ai*"]
30
+ exclude = ["assets*", "docs*", "tests*", ".gemini*"]
31
+
32
+ [tool.setuptools.package-data]
33
+ "*" = ["*.txt", "*.md"]
@@ -17,8 +17,7 @@ def test_advanced_config_aliases():
17
17
  def test_provider_instantiation():
18
18
  # These should succeed with a fake key because clients are lazy-loaded or just stored
19
19
  # We set env var to None to ensure it uses the passed key
20
- if "OPENAI_API_KEY" in os.environ:
21
- del os.environ["OPENAI_API_KEY"]
20
+ os.environ.pop("OPENAI_API_KEY", None)
22
21
 
23
22
  ai = OpenAI(api_key="sk-fake-key-for-testing")
24
23
  assert ai.api_key == "sk-fake-key-for-testing"
File without changes
File without changes
File without changes