sunholo 0.143.16__py3-none-any.whl → 0.144.0__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.
@@ -15,12 +15,17 @@ from ..custom_logging import log
15
15
  from ..utils import ConfigManager
16
16
  from ..auth import get_header
17
17
  import requests
18
- import aiohttp
19
18
  from .langserve import prepare_request_data
20
19
  import traceback
21
20
  from .route import route_endpoint
22
21
  import os
23
22
 
23
+ try:
24
+ import aiohttp
25
+ AIOHTTP_AVAILABLE = True
26
+ except ImportError:
27
+ AIOHTTP_AVAILABLE = False
28
+
24
29
 
25
30
  def prep_request_payload(user_input, chat_history, vector_name, stream, **kwargs):
26
31
  """
@@ -177,7 +182,16 @@ async def send_to_qa_async(user_input, vector_name, chat_history, stream=False,
177
182
  async for response_chunk in send_to_qa_async("What is AI?", "my_vector", []):
178
183
  print(response_chunk)
179
184
  ```
180
- """
185
+
186
+ Raises:
187
+ ImportError: If aiohttp is not installed.
188
+ """
189
+ if not AIOHTTP_AVAILABLE:
190
+ raise ImportError(
191
+ "aiohttp is required for async operations. "
192
+ "Install it with: pip install aiohttp or pip install sunholo[http]"
193
+ )
194
+
181
195
  qna_endpoint, qna_data = prep_request_payload(user_input, chat_history, vector_name, stream, **kwargs)
182
196
  header = get_header(vector_name)
183
197
  header = add_header_ids(header, **kwargs)
@@ -1,2 +1,3 @@
1
1
  from .qna_routes import register_qna_fastapi_routes
2
- from .base import create_fastapi_app
2
+ from .base import create_fastapi_app
3
+ from .vac_routes import VACRoutesFastAPI, VACRequest