dwani 0.1.9__py3-none-any.whl → 0.1.10__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.
dwani/__init__.py CHANGED
@@ -4,10 +4,10 @@ from .audio import Audio
4
4
  from .vision import Vision
5
5
  from .asr import ASR
6
6
  from .translate import Translate
7
- from .exceptions import DhwaniAPIError
7
+ from .exceptions import DwaniAPIError
8
8
  from .docs import Documents
9
9
 
10
- __all__ = ["DwaniClient", "Chat", "Audio", "Vision", "ASR", "DhwaniAPIError", "Translate", "Documents"]
10
+ __all__ = ["DwaniClient", "Chat", "Audio", "Vision", "ASR", "DwaniAPIError", "Translate", "Documents"]
11
11
 
12
12
  # Optionally, instantiate a default client for convenience
13
13
  api_key = None
dwani/asr.py CHANGED
@@ -1,4 +1,4 @@
1
- from .exceptions import DhwaniAPIError
1
+ from .exceptions import DwaniAPIError
2
2
  import requests
3
3
 
4
4
  # Allowed languages (case-sensitive for display, but we'll handle case-insensitively)
@@ -13,7 +13,9 @@ ALLOWED_LANGUAGES = [
13
13
  "Odia",
14
14
  "Punjabi",
15
15
  "Tamil",
16
- "Telugu"
16
+ "Telugu",
17
+ "English",
18
+ "German"
17
19
  ]
18
20
 
19
21
  def validate_language(language):
@@ -43,7 +45,7 @@ def asr_transcribe(client, file_path, language):
43
45
  files=files
44
46
  )
45
47
  if resp.status_code != 200:
46
- raise DhwaniAPIError(resp)
48
+ raise DwaniAPIError(resp)
47
49
  return resp.json()
48
50
 
49
51
  class ASR:
dwani/audio.py CHANGED
@@ -1,4 +1,4 @@
1
- from .exceptions import DhwaniAPIError
1
+ from .exceptions import DwaniAPIError
2
2
  import requests
3
3
 
4
4
  def audio_speech(client, input, response_format="mp3", output_file=None):
@@ -14,7 +14,7 @@ def audio_speech(client, input, response_format="mp3", output_file=None):
14
14
  stream=True
15
15
  )
16
16
  if resp.status_code != 200:
17
- raise DhwaniAPIError(resp)
17
+ raise DwaniAPIError(resp)
18
18
  if output_file:
19
19
  with open(output_file, "wb") as f:
20
20
  for chunk in resp.iter_content(chunk_size=8192):
dwani/chat.py CHANGED
@@ -1,4 +1,4 @@
1
- from .exceptions import DhwaniAPIError
1
+ from .exceptions import DwaniAPIError
2
2
  import requests
3
3
 
4
4
  # Language options mapping
@@ -7,14 +7,15 @@ language_options = [
7
7
  ("Kannada", "kan_Knda"),
8
8
  ("Hindi", "hin_Deva"),
9
9
  ("Assamese", "asm_Beng"),
10
- ("Bengali", "ben_Beng"),
11
- ("Gujarati", "guj_Gujr"),
12
- ("Malayalam", "mal_Mlym"),
13
- ("Marathi", "mar_Deva"),
14
- ("Odia", "ory_Orya"),
15
- ("Punjabi", "pan_Guru"),
16
- ("Tamil", "tam_Taml"),
17
- ("Telugu", "tel_Telu")
10
+ ("Bengali","ben_Beng"),
11
+ ("Gujarati","guj_Gujr"),
12
+ ("Malayalam","mal_Mlym"),
13
+ ("Marathi","mar_Deva"),
14
+ ("Odia","ory_Orya"),
15
+ ("Punjabi","pan_Guru"),
16
+ ("Tamil","tam_Taml"),
17
+ ("Telugu","tel_Telu"),
18
+ ("German","deu_Latn"),
18
19
  ]
19
20
 
20
21
  # Create a dictionary for language name to code mapping
@@ -58,7 +59,7 @@ def chat_create(client, prompt, src_lang, tgt_lang, model="gemma3"):
58
59
  json=payload
59
60
  )
60
61
  if resp.status_code != 200:
61
- raise DhwaniAPIError(resp)
62
+ raise DwaniAPIError(resp)
62
63
  return resp.json()
63
64
 
64
65
  class Chat:
dwani/client.py CHANGED
@@ -1,6 +1,6 @@
1
1
  import os
2
2
  import requests
3
- from .exceptions import DhwaniAPIError
3
+ from .exceptions import DwaniAPIError
4
4
 
5
5
  class DwaniClient:
6
6
  def __init__(self, api_key=None, api_base=None):
dwani/docs.py CHANGED
@@ -1,5 +1,6 @@
1
1
  import requests
2
- from .exceptions import DhwaniAPIError
2
+
3
+ from .exceptions import DwaniAPIError
3
4
  import logging
4
5
 
5
6
  # Set up logging
@@ -11,7 +12,8 @@ language_options = [
11
12
  ("Kannada", "kan_Knda"),
12
13
  ("Hindi", "hin_Deva"),
13
14
  ("Tamil", "tam_Taml"),
14
- ("Telugu", "tel_Telu")
15
+ ("Telugu", "tel_Telu"),
16
+ ("German", "deu_Latn")
15
17
  ]
16
18
 
17
19
  # Create dictionaries for language name to code and code to code mapping
@@ -61,7 +63,7 @@ def document_ocr(client, file_path, language=None, model="gemma3"):
61
63
  resp.raise_for_status()
62
64
  except requests.RequestException as e:
63
65
  logger.error(f"OCR request failed: {str(e)}")
64
- raise DhwaniAPIError(resp) if 'resp' in locals() else DhwaniAPIError.from_exception(e)
66
+ raise DwaniAPIError(resp) if 'resp' in locals() else DwaniAPIError.from_exception(e)
65
67
 
66
68
  logger.debug(f"OCR response: {resp.status_code}")
67
69
  return resp.json()
@@ -89,6 +91,7 @@ def document_summarize(client, file_path, page_number=1, src_lang="eng_Latn", tg
89
91
  "tgt_lang": tgt_lang_code,
90
92
  "model": model
91
93
  }
94
+
92
95
  try:
93
96
  resp = requests.post(
94
97
  url,
@@ -100,9 +103,10 @@ def document_summarize(client, file_path, page_number=1, src_lang="eng_Latn", tg
100
103
  resp.raise_for_status()
101
104
  except requests.RequestException as e:
102
105
  logger.error(f"Summarize request failed: {str(e)}")
103
- raise DhwaniAPIError(resp) if 'resp' in locals() else DhwaniAPIError.from_exception(e)
106
+ raise DwaniAPIError(resp) if 'resp' in locals() else DwaniAPIError.from_exception(e)
104
107
 
105
108
  logger.debug(f"Summarize response: {resp.status_code}")
109
+
106
110
  return resp.json()
107
111
 
108
112
  def extract(client, file_path, page_number=1, src_lang="eng_Latn", tgt_lang="kan_Knda", model="gemma3"):
@@ -122,6 +126,7 @@ def extract(client, file_path, page_number=1, src_lang="eng_Latn", tgt_lang="kan
122
126
  headers = client._headers()
123
127
  with open(file_path, "rb") as f:
124
128
  files = {"file": (file_path, f, "application/pdf")}
129
+
125
130
  data = {
126
131
  "page_number": str(page_number),
127
132
  "src_lang": src_lang_code,
@@ -139,9 +144,10 @@ def extract(client, file_path, page_number=1, src_lang="eng_Latn", tgt_lang="kan
139
144
  resp.raise_for_status()
140
145
  except requests.RequestException as e:
141
146
  logger.error(f"Extract request failed: {str(e)}")
142
- raise DhwaniAPIError(resp) if 'resp' in locals() else DhwaniAPIError.from_exception(e)
147
+ raise DwaniAPIError(resp) if 'resp' in locals() else DwaniAPIError.from_exception(e)
143
148
 
144
149
  logger.debug(f"Extract response: {resp.status_code}")
150
+
145
151
  return resp.json()
146
152
 
147
153
  def doc_query(
@@ -178,6 +184,7 @@ def doc_query(
178
184
  "tgt_lang": tgt_lang_code,
179
185
  "model": model
180
186
  }
187
+
181
188
  try:
182
189
  resp = requests.post(
183
190
  url,
@@ -189,9 +196,10 @@ def doc_query(
189
196
  resp.raise_for_status()
190
197
  except requests.RequestException as e:
191
198
  logger.error(f"Doc query request failed: {str(e)}")
192
- raise DhwaniAPIError(resp) if 'resp' in locals() else DhwaniAPIError.from_exception(e)
199
+ raise DwaniAPIError(resp) if 'resp' in locals() else DwaniAPIError.from_exception(e)
193
200
 
194
201
  logger.debug(f"Doc query response: {resp.status_code}")
202
+
195
203
  return resp.json()
196
204
 
197
205
  def doc_query_kannada(
@@ -221,6 +229,7 @@ def doc_query_kannada(
221
229
  headers = client._headers()
222
230
  with open(file_path, "rb") as f:
223
231
  files = {"file": (file_path, f, "application/pdf")}
232
+
224
233
  data = {
225
234
  "page_number": str(page_number),
226
235
  "prompt": prompt,
@@ -239,9 +248,10 @@ def doc_query_kannada(
239
248
  resp.raise_for_status()
240
249
  except requests.RequestException as e:
241
250
  logger.error(f"Doc query Kannada request failed: {str(e)}")
242
- raise DhwaniAPIError(resp) if 'resp' in locals() else DhwaniAPIError.from_exception(e)
251
+ raise DwaniAPIError(resp) if 'resp' in locals() else DwaniAPIError.from_exception(e)
243
252
 
244
253
  logger.debug(f"Doc query Kannada response: {resp.status_code}")
254
+
245
255
  return resp.json()
246
256
 
247
257
  class Documents:
dwani/exceptions.py CHANGED
@@ -1,4 +1,4 @@
1
- class DhwaniAPIError(Exception):
1
+ class DwaniAPIError(Exception):
2
2
  def __init__(self, response):
3
3
  super().__init__(f"API Error {response.status_code}: {response.text}")
4
4
  self.status_code = response.status_code
dwani/translate.py CHANGED
@@ -1,4 +1,4 @@
1
- from .exceptions import DhwaniAPIError
1
+ from .exceptions import DwaniAPIError
2
2
  import requests
3
3
 
4
4
  # Language options mapping
@@ -14,7 +14,8 @@ language_options = [
14
14
  ("Odia", "ory_Orya"),
15
15
  ("Punjabi", "pan_Guru"),
16
16
  ("Tamil", "tam_Taml"),
17
- ("Telugu", "tel_Telu")
17
+ ("Telugu", "tel_Telu"),
18
+ ("German", "deu_Latn")
18
19
  ]
19
20
 
20
21
  # Create dictionaries for language name to code and code to code mapping
@@ -62,7 +63,7 @@ def run_translate(client, sentences, src_lang, tgt_lang):
62
63
  json=payload
63
64
  )
64
65
  if resp.status_code != 200:
65
- raise DhwaniAPIError(resp)
66
+ raise DwaniAPIError(resp)
66
67
  return resp.json()
67
68
 
68
69
  class Translate:
dwani/vision.py CHANGED
@@ -1,4 +1,4 @@
1
- from .exceptions import DhwaniAPIError
1
+ from .exceptions import DwaniAPIError
2
2
  import requests
3
3
 
4
4
  # Language options mapping
@@ -14,7 +14,8 @@ language_options = [
14
14
  ("Odia", "ory_Orya"),
15
15
  ("Punjabi", "pan_Guru"),
16
16
  ("Tamil", "tam_Taml"),
17
- ("Telugu", "tel_Telu")
17
+ ("Telugu", "tel_Telu"),
18
+ ("German","deu_Latn")
18
19
  ]
19
20
 
20
21
  # Create dictionaries for language name to code and code to code mapping
@@ -64,7 +65,7 @@ def vision_caption(client, file_path, query="describe the image", src_lang="eng_
64
65
  data=data
65
66
  )
66
67
  if resp.status_code != 200:
67
- raise DhwaniAPIError(resp)
68
+ raise DwaniAPIError(resp)
68
69
  return resp.json()
69
70
 
70
71
  class Vision:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dwani
3
- Version: 0.1.9
3
+ Version: 0.1.10
4
4
  Summary: Multimodal API for Indian languages (Chat, Vision, TTS, ASR, Translate, Docs)
5
5
  Author-email: sachin <python@dwani.ai>
6
6
  License: MIT License
@@ -39,7 +39,7 @@ Dynamic: license-file
39
39
 
40
40
  ### Install the library
41
41
  ```bash
42
- pip install --upgrade dwani
42
+ pip install dwani
43
43
  ```
44
44
 
45
45
  ### Languages supported
@@ -59,7 +59,7 @@ dwani.api_base = os.getenv("DWANI_API_BASE_URL")
59
59
  ### Text Query
60
60
  ---
61
61
  - With model selection
62
- - Supported models : gemma3 (default), qwen3
62
+ - Supported models : gemma3 (default), qwen3, deepseek-r1-8b, sarvam-m
63
63
 
64
64
  ---
65
65
  - gemma3
@@ -0,0 +1,14 @@
1
+ dwani/__init__.py,sha256=k1fWBnAp5zHQaYnOpUwzPIngqzVO4wIQr1wp5kPyzfE,2663
2
+ dwani/asr.py,sha256=BAdqivQd57NJZX1dSY-J6EFi8TDdyuhf_AyCPcQ0M7w,1719
3
+ dwani/audio.py,sha256=MWsIZazL91c2wa5AE1YY78l9RKaJwNFFHIajuwl43Jg,886
4
+ dwani/chat.py,sha256=K3OJHQcRhU0aVmWBqajZqbfZg_Q5Dfm6Es3YMSpkxGY,2332
5
+ dwani/client.py,sha256=UsRLoYZgj25F-qCGlATvElG6r3EWxqndeMv696cBk1w,2904
6
+ dwani/docs.py,sha256=Cp0Gtudug79GH25toB-Npl35ZFA0TM32oZF2xH1VmNY,10598
7
+ dwani/exceptions.py,sha256=n06dPmR20rS4T3sJBWHQhGxzg4SJKzird9Hx0YTwwo0,226
8
+ dwani/translate.py,sha256=-6UHV5hu1oBxuDlGlGYp13bFDayKWwo1rBkJhE-LRMs,2568
9
+ dwani/vision.py,sha256=9tRPhEXFQ3n-80XxVCs1qrEKqvzsoxGQTOKs2fTwQTI,2699
10
+ dwani-0.1.10.dist-info/licenses/LICENSE,sha256=IAD8tbwWZbPWHXgYjabHoMv0aaUzZUYzYiEbfhTCisY,1070
11
+ dwani-0.1.10.dist-info/METADATA,sha256=YUBayRe_IiFtbeJhr3Wu9trPBRGykVDngdzZGD8_2pk,5062
12
+ dwani-0.1.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
13
+ dwani-0.1.10.dist-info/top_level.txt,sha256=AM5EhkyuO_EXQFR9JIxEV6tAYMCCyc-a1dLifpCGBUk,6
14
+ dwani-0.1.10.dist-info/RECORD,,
@@ -1,14 +0,0 @@
1
- dwani/__init__.py,sha256=JcbP7N6J-is-r5g5aDM8OluuCD1V5HxT3TgMtLwcH8s,2665
2
- dwani/asr.py,sha256=3LYrLOaMhc5eXKFSoi63C8KAvwZI2NcuO25pwTfSVe0,1692
3
- dwani/audio.py,sha256=Q9vw4uBxGy1vQzmiZjZGrY8hkAEQNkGhjz5OcnpFEQQ,888
4
- dwani/chat.py,sha256=a6Bd0Skx9Fi4UVCj_-FfUR0wt3y8ep1AV7Q7kEqvpzA,2315
5
- dwani/client.py,sha256=sDSA1F1Ixh08uaSf4tuzsOm72oEAUi9w3dUiP3fyvUk,2905
6
- dwani/docs.py,sha256=PBCUHyulcV1AYX7WcX_uKLkYjUQ48zAZ9PK9Rrvhy6s,10571
7
- dwani/exceptions.py,sha256=qEN5ukqlnN7v-kHNEnISWFMpPMt6uTft9mPsTXJ4LVA,227
8
- dwani/translate.py,sha256=nYqKX7TDz6hds2Ih-CWXWkS8Bd_4KXVY_NG7erhtS_8,2542
9
- dwani/vision.py,sha256=rfmcLFPdZC1MLdYAG3aRdCW22-gkXfjqm6WYZJ1Ac2k,2674
10
- dwani-0.1.9.dist-info/licenses/LICENSE,sha256=IAD8tbwWZbPWHXgYjabHoMv0aaUzZUYzYiEbfhTCisY,1070
11
- dwani-0.1.9.dist-info/METADATA,sha256=hjS9WvvbnDJ3IZQkkg7PV4sRnbyBJmrxD0kz5Q4TFuc,5045
12
- dwani-0.1.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
13
- dwani-0.1.9.dist-info/top_level.txt,sha256=AM5EhkyuO_EXQFR9JIxEV6tAYMCCyc-a1dLifpCGBUk,6
14
- dwani-0.1.9.dist-info/RECORD,,
File without changes