pyindus 0.1.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.
pyindus-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,108 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyindus
3
+ Version: 0.1.0
4
+ Summary: Python package for Indus Chat API by Sarvam AI
5
+ Author: Abhishek Verma
6
+ License: MIT
7
+ Keywords: ai,api,chatbot,indus,sarvam
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Requires-Python: >=3.10
17
+ Requires-Dist: httpx>=0.27.0
18
+ Requires-Dist: pydantic>=2.0.0
19
+ Description-Content-Type: text/markdown
20
+
21
+ # PyIndus
22
+
23
+ A Python package for interacting with [Indus](https://indus.sarvam.ai), a ChatGPT alternative by Sarvam AI.
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ pip install pyindus
29
+ ```
30
+
31
+ Or with uv:
32
+
33
+ ```bash
34
+ uv add pyindus
35
+ ```
36
+
37
+ ## Quick Start
38
+
39
+ `IndusClient` acts as a fully-featured, seamless SDK. It **automatically saves, loads, and refreshes sessions** for you.
40
+
41
+ ### 1. Initial Login
42
+ Run this once to authenticate. The client will automatically save your session to `indus_session.json` by default.
43
+
44
+ ```python
45
+ from pyindus import IndusClient
46
+
47
+ # Login with phone number
48
+ client = IndusClient()
49
+ client.login("+91XXXXXXXXXX")
50
+
51
+ # Enter the OTP received via SMS
52
+ client.verify_otp("123456")
53
+
54
+ # The session is now authenticated and saved automatically!
55
+ ```
56
+
57
+ ### 2. Immediate Re-use (Like an SDK)
58
+ Run this anywhere else in your project. Because the session was saved, the client automatically loads it on `__init__`. *If the token expires, the client will dynamically refresh it in the background.*
59
+
60
+ ```python
61
+ from pyindus import IndusClient
62
+
63
+ # Automatically loads the previous session from 'indus_session.json'
64
+ client = IndusClient()
65
+
66
+ # Chat directly! No need to login again.
67
+ response = client.chat("What is quantum computing?")
68
+ print(response.answer)
69
+ ```
70
+
71
+ ## Integration Guide: Custom Paths
72
+
73
+ If you're building a web app or managing multiple users, you can specify individual session files.
74
+
75
+ ```python
76
+ from pyindus import IndusClient
77
+
78
+ # Supply a unique path for the user's session
79
+ def handle_user_request(user_id, message):
80
+ session_path = f"sessions/user_{user_id}.json"
81
+
82
+ # Auto-loads and manages session in this specific file
83
+ with IndusClient(session_file=session_path) as client:
84
+ return client.chat(message)
85
+ ```
86
+
87
+ ## Advanced Usage
88
+
89
+ ### Working with Specific Models
90
+ Indus supports different "Task Graphs" (models like Sarvam Think, Bulbul, etc.). By default, `IndusClient` selects the first available chat model automatically.
91
+
92
+ ```python
93
+ from pyindus import IndusClient
94
+
95
+ with IndusClient() as client:
96
+ # List available models
97
+ models = client.get_models()
98
+ for model in models:
99
+ print(f"{model.name}: {model.description}")
100
+
101
+ # Use a specific model
102
+ response = client.chat("Explain gravity", task_graph_uid=models[-1].uid)
103
+ print(response.answer)
104
+ ```
105
+
106
+ ## License
107
+
108
+ MIT
@@ -0,0 +1,88 @@
1
+ # PyIndus
2
+
3
+ A Python package for interacting with [Indus](https://indus.sarvam.ai), a ChatGPT alternative by Sarvam AI.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install pyindus
9
+ ```
10
+
11
+ Or with uv:
12
+
13
+ ```bash
14
+ uv add pyindus
15
+ ```
16
+
17
+ ## Quick Start
18
+
19
+ `IndusClient` acts as a fully-featured, seamless SDK. It **automatically saves, loads, and refreshes sessions** for you.
20
+
21
+ ### 1. Initial Login
22
+ Run this once to authenticate. The client will automatically save your session to `indus_session.json` by default.
23
+
24
+ ```python
25
+ from pyindus import IndusClient
26
+
27
+ # Login with phone number
28
+ client = IndusClient()
29
+ client.login("+91XXXXXXXXXX")
30
+
31
+ # Enter the OTP received via SMS
32
+ client.verify_otp("123456")
33
+
34
+ # The session is now authenticated and saved automatically!
35
+ ```
36
+
37
+ ### 2. Immediate Re-use (Like an SDK)
38
+ Run this anywhere else in your project. Because the session was saved, the client automatically loads it on `__init__`. *If the token expires, the client will dynamically refresh it in the background.*
39
+
40
+ ```python
41
+ from pyindus import IndusClient
42
+
43
+ # Automatically loads the previous session from 'indus_session.json'
44
+ client = IndusClient()
45
+
46
+ # Chat directly! No need to login again.
47
+ response = client.chat("What is quantum computing?")
48
+ print(response.answer)
49
+ ```
50
+
51
+ ## Integration Guide: Custom Paths
52
+
53
+ If you're building a web app or managing multiple users, you can specify individual session files.
54
+
55
+ ```python
56
+ from pyindus import IndusClient
57
+
58
+ # Supply a unique path for the user's session
59
+ def handle_user_request(user_id, message):
60
+ session_path = f"sessions/user_{user_id}.json"
61
+
62
+ # Auto-loads and manages session in this specific file
63
+ with IndusClient(session_file=session_path) as client:
64
+ return client.chat(message)
65
+ ```
66
+
67
+ ## Advanced Usage
68
+
69
+ ### Working with Specific Models
70
+ Indus supports different "Task Graphs" (models like Sarvam Think, Bulbul, etc.). By default, `IndusClient` selects the first available chat model automatically.
71
+
72
+ ```python
73
+ from pyindus import IndusClient
74
+
75
+ with IndusClient() as client:
76
+ # List available models
77
+ models = client.get_models()
78
+ for model in models:
79
+ print(f"{model.name}: {model.description}")
80
+
81
+ # Use a specific model
82
+ response = client.chat("Explain gravity", task_graph_uid=models[-1].uid)
83
+ print(response.answer)
84
+ ```
85
+
86
+ ## License
87
+
88
+ MIT
@@ -0,0 +1,180 @@
1
+ {
2
+ "created_at": "2026-02-20T21:48:18.915Z",
3
+ "expires_at": "2026-02-20T22:48:18.912Z",
4
+ "id": "3cf98999-dcf4-4350-982f-663c436e15ea",
5
+ "issued_at": "2026-02-20T21:48:18.912Z",
6
+ "refresh": false,
7
+ "request_url": "https://login.sarvam.ai/self-service/login/browser?return_to=https%3A%2F%2Findus.sarvam.ai",
8
+ "requested_aal": "aal1",
9
+ "return_to": "https://indus.sarvam.ai",
10
+ "state": "choose_method",
11
+ "type": "browser",
12
+ "ui": {
13
+ "action": "https://login.sarvam.ai/identity/self-service/login?flow=3cf98999-dcf4-4350-982f-663c436e15ea",
14
+ "method": "POST",
15
+ "nodes": [
16
+ {
17
+ "attributes": {
18
+ "disabled": false,
19
+ "name": "provider",
20
+ "node_type": "input",
21
+ "type": "submit",
22
+ "value": "apple"
23
+ },
24
+ "group": "oidc",
25
+ "messages": [],
26
+ "meta": {
27
+ "label": {
28
+ "context": {
29
+ "provider": "apple",
30
+ "provider_id": "apple"
31
+ },
32
+ "id": 1010002,
33
+ "text": "Sign in with apple",
34
+ "type": "info"
35
+ }
36
+ },
37
+ "type": "input"
38
+ },
39
+ {
40
+ "attributes": {
41
+ "disabled": false,
42
+ "name": "provider",
43
+ "node_type": "input",
44
+ "type": "submit",
45
+ "value": "google"
46
+ },
47
+ "group": "oidc",
48
+ "messages": [],
49
+ "meta": {
50
+ "label": {
51
+ "context": {
52
+ "provider": "google",
53
+ "provider_id": "google"
54
+ },
55
+ "id": 1010002,
56
+ "text": "Sign in with google",
57
+ "type": "info"
58
+ }
59
+ },
60
+ "type": "input"
61
+ },
62
+ {
63
+ "attributes": {
64
+ "disabled": false,
65
+ "name": "provider",
66
+ "node_type": "input",
67
+ "type": "submit",
68
+ "value": "microsoft"
69
+ },
70
+ "group": "oidc",
71
+ "messages": [],
72
+ "meta": {
73
+ "label": {
74
+ "context": {
75
+ "provider": "microsoft",
76
+ "provider_id": "microsoft"
77
+ },
78
+ "id": 1010002,
79
+ "text": "Sign in with microsoft",
80
+ "type": "info"
81
+ }
82
+ },
83
+ "type": "input"
84
+ },
85
+ {
86
+ "attributes": {
87
+ "disabled": false,
88
+ "name": "csrf_token",
89
+ "node_type": "input",
90
+ "required": true,
91
+ "type": "hidden",
92
+ "value": "qclbJjY8k8SUAgnBYhdWMxfbFsmoR5jsVt3B4CMXfihgkrH1i82AnarTqGS9UZNJFdhF+DvPtK5KOP5aDHsJ8g=="
93
+ },
94
+ "group": "default",
95
+ "messages": [],
96
+ "meta": {},
97
+ "type": "input"
98
+ },
99
+ {
100
+ "attributes": {
101
+ "disabled": false,
102
+ "name": "identifier",
103
+ "node_type": "input",
104
+ "required": true,
105
+ "type": "text",
106
+ "value": ""
107
+ },
108
+ "group": "default",
109
+ "messages": [],
110
+ "meta": {
111
+ "label": {
112
+ "id": 1070004,
113
+ "text": "ID",
114
+ "type": "info"
115
+ }
116
+ },
117
+ "type": "input"
118
+ },
119
+ {
120
+ "attributes": {
121
+ "disabled": false,
122
+ "name": "method",
123
+ "node_type": "input",
124
+ "type": "submit",
125
+ "value": "code"
126
+ },
127
+ "group": "code",
128
+ "messages": [],
129
+ "meta": {
130
+ "label": {
131
+ "id": 1010015,
132
+ "text": "Send sign in code",
133
+ "type": "info"
134
+ }
135
+ },
136
+ "type": "input"
137
+ },
138
+ {
139
+ "attributes": {
140
+ "autocomplete": "current-password",
141
+ "disabled": false,
142
+ "name": "password",
143
+ "node_type": "input",
144
+ "required": true,
145
+ "type": "password"
146
+ },
147
+ "group": "password",
148
+ "messages": [],
149
+ "meta": {
150
+ "label": {
151
+ "id": 1070001,
152
+ "text": "Password",
153
+ "type": "info"
154
+ }
155
+ },
156
+ "type": "input"
157
+ },
158
+ {
159
+ "attributes": {
160
+ "disabled": false,
161
+ "name": "method",
162
+ "node_type": "input",
163
+ "type": "submit",
164
+ "value": "password"
165
+ },
166
+ "group": "password",
167
+ "messages": [],
168
+ "meta": {
169
+ "label": {
170
+ "id": 1010022,
171
+ "text": "Sign in with password",
172
+ "type": "info"
173
+ }
174
+ },
175
+ "type": "input"
176
+ }
177
+ ]
178
+ },
179
+ "updated_at": "2026-02-20T21:48:18.915Z"
180
+ }
@@ -0,0 +1,3 @@
1
+ Flow: ab40521b-fd00-4a30-acfc-fd2557291b40
2
+ CSRF: None
3
+ REDIRECT: https://login.sarvam.ai/error?id=223298c8-73df-45bb-bbfe-ab6ad59eb7d6
@@ -0,0 +1,4 @@
1
+ {
2
+ "cookies": [],
3
+ "authenticated": true
4
+ }