askai-python 0.2.1__py3-none-any.whl → 0.3.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.
ask_ai/base.py CHANGED
@@ -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
@@ -1,10 +1,11 @@
1
1
  ask_ai/__init__.py,sha256=i08NdBtFsjV3vT9ZqhEsroXd7vvZrWDojsOW-79iTV4,439
2
2
  ask_ai/__main__.py,sha256=MSmt_5Xg84uHqzTN38JwgseJK8rsJn_11A8WD99VtEo,61
3
- ask_ai/base.py,sha256=pMNc6YhHiWasi1IH6Qe6xdtNwoxzQu68JPW5KBrZCsE,8543
3
+ ask_ai/base.py,sha256=Hxk7hFJqK8uBSabVBAMrLziPdEo0QWrGrGgpIlIEcN8,8934
4
4
  ask_ai/cli.py,sha256=8oeRLsT2lrcuG0vDq_a4CVqvzzmwDG3HxHW4BYg3IxM,2708
5
5
  ask_ai/config.py,sha256=oP5RjdbbdDve8G-FlcbNaMXPorBw96GxhCbfFWnfbIw,1934
6
6
  ask_ai/exceptions.py,sha256=jUP1tJJvvx8ymFXU19Em3JBbTPixEnO_uj6ZC5zDyEM,893
7
7
  ask_ai/media.py,sha256=cxPZ0XoY0iU3Y8bY-YV3MGPlNFOJ_FjjwMATgo-jcFw,1821
8
+ ask_ai/requirements.txt,sha256=Nvs7a0Ol8J6bTUWUJ02VqjNo9jazd6houEmDLqu-Qcw,58
8
9
  ask_ai/utils.py,sha256=cRokmKtoNOgQsGrKTdKBjv9vdG3sXpiA6W9HtcjNIho,1582
9
10
  ask_ai/providers/__init__.py,sha256=tVSW-FfSMPzCYK_TZy93W5ckdVe2PBPyzogpKXH_jhg,341
10
11
  ask_ai/providers/anthropic_provider.py,sha256=NL_6E7eNTYAoYpym4ewD8Vj8tF_ewuFjFkRR0Jj0L-U,3670
@@ -13,8 +14,8 @@ ask_ai/providers/google_provider.py,sha256=DsIgu_cBC7ta0lKclAlge1PYfcp3zXKPLjWSe
13
14
  ask_ai/providers/groq_provider.py,sha256=iU7BTpvmBniE78VdTQETrCXrJzdXTpWH2oN9_sUgnFk,3268
14
15
  ask_ai/providers/openai_provider.py,sha256=b6grPbsUIY19HkABDrUIAZAIcJCKQup5tooU2LFlkvo,4793
15
16
  ask_ai/providers/openrouter_provider.py,sha256=LCGK-vNxy_maY2Fle6xh_i8MVm7a_bhjCaF7Uj0H3AM,1986
16
- askai_python-0.2.1.dist-info/licenses/LICENSE,sha256=SUSbAUsh_Uqw7NDEKwAGRVPS7sojihBHIBGBx6WZxvg,1073
17
- askai_python-0.2.1.dist-info/METADATA,sha256=sDAgOTv2w_wTOBcJrOp5-c8io7eMgHi13kjcv2h_myE,4218
18
- askai_python-0.2.1.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
19
- askai_python-0.2.1.dist-info/top_level.txt,sha256=fW2GapXaz6f-2UAuzVVPUPNfZUK_ZS1dpLyCllcE03s,7
20
- askai_python-0.2.1.dist-info/RECORD,,
17
+ askai_python-0.3.3.dist-info/licenses/LICENSE,sha256=SUSbAUsh_Uqw7NDEKwAGRVPS7sojihBHIBGBx6WZxvg,1073
18
+ askai_python-0.3.3.dist-info/METADATA,sha256=o3baxmEPjdg7wflgM-aLxRL-FVuw5Q4tIJL8bVCCh90,4558
19
+ askai_python-0.3.3.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
20
+ askai_python-0.3.3.dist-info/top_level.txt,sha256=fW2GapXaz6f-2UAuzVVPUPNfZUK_ZS1dpLyCllcE03s,7
21
+ askai_python-0.3.3.dist-info/RECORD,,