pairit 0.4.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.
- pairit-0.4.0/LICENSE +21 -0
- pairit-0.4.0/PKG-INFO +200 -0
- pairit-0.4.0/README.md +175 -0
- pairit-0.4.0/pair/__init__.py +26 -0
- pairit-0.4.0/pair/bridge.py +1429 -0
- pairit-0.4.0/pair/client.py +397 -0
- pairit-0.4.0/pair/exceptions.py +22 -0
- pairit-0.4.0/pair/types.py +36 -0
- pairit-0.4.0/pairit/__init__.py +24 -0
- pairit-0.4.0/pairit/bridge.py +1429 -0
- pairit-0.4.0/pairit/client.py +397 -0
- pairit-0.4.0/pairit/exceptions.py +26 -0
- pairit-0.4.0/pairit/types.py +36 -0
- pairit-0.4.0/pairit.egg-info/PKG-INFO +200 -0
- pairit-0.4.0/pairit.egg-info/SOURCES.txt +18 -0
- pairit-0.4.0/pairit.egg-info/dependency_links.txt +1 -0
- pairit-0.4.0/pairit.egg-info/requires.txt +1 -0
- pairit-0.4.0/pairit.egg-info/top_level.txt +2 -0
- pairit-0.4.0/pyproject.toml +37 -0
- pairit-0.4.0/setup.cfg +4 -0
pairit-0.4.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Naveen Kumar
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
pairit-0.4.0/PKG-INFO
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pairit
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Turn your browser AI sessions into a local development interface
|
|
5
|
+
Author: Naveen Kumar
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/naveenkumarr1812/PairIt
|
|
8
|
+
Project-URL: Repository, https://github.com/naveenkumarr1812/PairIt
|
|
9
|
+
Project-URL: Issues, https://github.com/naveenkumarr1812/PairIt/issues
|
|
10
|
+
Keywords: pairit,ai,chatgpt,claude,gemini,browser,bridge,router,chrome-extension
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: aiohttp<4,>=3.9
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
<p align="center">
|
|
27
|
+
<img src="https://raw.githubusercontent.com/naveenkumarr1812/PairIt/main/assets/logo.png" alt="pAIrit – Your Code. Your Browser. Your AI." width="600"/>
|
|
28
|
+
</p>
|
|
29
|
+
|
|
30
|
+
<p align="center">
|
|
31
|
+
<strong>Turn your browser AI sessions into a local development interface</strong>
|
|
32
|
+
</p>
|
|
33
|
+
|
|
34
|
+
<p align="center">
|
|
35
|
+
<a href="https://pypi.org/project/pairit/"><img src="https://img.shields.io/pypi/v/pairit?color=7C3AED&label=PyPI&style=flat-square" alt="PyPI version"/></a>
|
|
36
|
+
<a href="https://pypi.org/project/pairit/"><img src="https://img.shields.io/pypi/pyversions/pairit?color=EA580C&style=flat-square" alt="Python versions"/></a>
|
|
37
|
+
<img src="https://img.shields.io/badge/Chrome%20Extension-MV3-4285F4?style=flat-square&logo=googlechrome&logoColor=white" alt="Chrome MV3"/>
|
|
38
|
+
<img src="https://img.shields.io/badge/license-MIT-22C55E?style=flat-square" alt="License MIT"/>
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## What is pAIrit?
|
|
44
|
+
|
|
45
|
+
**pAIrit** is a developer-focused bridge that lets a local Python application talk to AI services — **ChatGPT, Claude, and Gemini** — through the browser tabs you already have open. No API keys, no separate billing; your Python code sends a request, pAIrit routes it to the right browser tab, and streams the answer back.
|
|
46
|
+
|
|
47
|
+
> **Note:** pAIrit is intended for local development workflows where the developer is already authenticated with the AI services in their browser.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## How It Works
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
Your Python Application
|
|
55
|
+
│
|
|
56
|
+
▼
|
|
57
|
+
pairit SDK (pip install pairit)
|
|
58
|
+
│
|
|
59
|
+
│ WebSocket
|
|
60
|
+
▼
|
|
61
|
+
Local pairit Bridge
|
|
62
|
+
│
|
|
63
|
+
│ Persistent connection
|
|
64
|
+
▼
|
|
65
|
+
PairIt Chrome Extension
|
|
66
|
+
┌────┴────┬───────┐
|
|
67
|
+
▼ ▼ ▼
|
|
68
|
+
ChatGPT Claude Gemini
|
|
69
|
+
(tab) (tab) (tab)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Design highlights:**
|
|
73
|
+
|
|
74
|
+
- Your app opens **one** WebSocket connection to the bridge — not a separate connection per provider.
|
|
75
|
+
- The extension locates a provider tab only when a request for that provider arrives.
|
|
76
|
+
- If the required tab is missing, PairIt returns a clear error:
|
|
77
|
+
`Claude is not open. Open Claude in a Chrome tab and try again.`
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Features
|
|
82
|
+
|
|
83
|
+
| Feature | Details |
|
|
84
|
+
|---|---|
|
|
85
|
+
| 🔄 **Multi-provider** | ChatGPT, Claude, Gemini — switch with one line |
|
|
86
|
+
| 📡 **Streaming** | Real-time browser-side streaming via DOM observer |
|
|
87
|
+
| 🔐 **No API keys** | Uses your existing logged-in browser sessions |
|
|
88
|
+
| 🪟 **Minimized Chrome** | Bridge stays alive even when Chrome is hidden |
|
|
89
|
+
| 🐍 **Python ≥ 3.10** | Async-first, built on `aiohttp` |
|
|
90
|
+
| 🧩 **Chrome MV3** | Modern Manifest V3 extension |
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Installation
|
|
95
|
+
|
|
96
|
+
### 1. Install the Python package
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
pip install pairit
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 2. Load the Chrome extension
|
|
103
|
+
|
|
104
|
+
The easiest option is to install PairIt directly from the [Chrome Web Store](https://chromewebstore.google.com/detail/pair/pkcgibncheoddhpfieekkjdffpmmenie).
|
|
105
|
+
|
|
106
|
+
1. Open the [Chrome Web Store listing](https://chromewebstore.google.com/detail/pair/pkcgibncheoddhpfieekkjdffpmmenie).
|
|
107
|
+
2. Click **Add to Chrome** and confirm the installation.
|
|
108
|
+
3. Pin the **PairIt** extension to your toolbar.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Quick Start
|
|
113
|
+
|
|
114
|
+
### Basic request
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
from pairit import Client
|
|
118
|
+
|
|
119
|
+
client = Client(provider="chatgpt")
|
|
120
|
+
|
|
121
|
+
try:
|
|
122
|
+
response = client.chat("Explain async programming in Python")
|
|
123
|
+
print(response.content)
|
|
124
|
+
finally:
|
|
125
|
+
client.close()
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Streaming
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
from pairit import Client
|
|
132
|
+
|
|
133
|
+
client = Client(provider="chatgpt")
|
|
134
|
+
|
|
135
|
+
try:
|
|
136
|
+
for chunk in client.chat("Explain Retrieval-Augmented Generation", stream=True):
|
|
137
|
+
print(chunk.content, end="", flush=True)
|
|
138
|
+
print()
|
|
139
|
+
finally:
|
|
140
|
+
client.close()
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
> `stream=False` (default) returns the full response after generation completes.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Developer Workflow
|
|
148
|
+
|
|
149
|
+
1. **Run** your Python script — the bridge starts automatically.
|
|
150
|
+
2. **Open** the required AI provider tabs in Chrome and stay logged in.
|
|
151
|
+
3. **Open** the PairIt extension popup and toggle it **ON**.
|
|
152
|
+
4. PairIt continuously attempts to connect to the bridge while the toggle is on.
|
|
153
|
+
5. **Send** requests from your code — pairit handles routing.
|
|
154
|
+
6. When finished, toggle the extension **OFF**.
|
|
155
|
+
|
|
156
|
+
> The extension does **not** auto-enable on a new Chrome session. You must turn it on manually to keep control explicit.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Status Model
|
|
161
|
+
|
|
162
|
+
PairIt tracks two independent states:
|
|
163
|
+
|
|
164
|
+
| State | Description |
|
|
165
|
+
|---|---|
|
|
166
|
+
| **Bridge connection** | Local Python app ↔ Chrome extension (WebSocket) |
|
|
167
|
+
| **Provider availability** | Whether a ChatGPT / Claude / Gemini tab is currently open |
|
|
168
|
+
|
|
169
|
+
A provider does **not** need to be permanently connected — it only needs to be open at the moment a request targets it.
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Safety & Scope
|
|
174
|
+
|
|
175
|
+
pAIrit is a development-only tool. It **does not**:
|
|
176
|
+
|
|
177
|
+
- ❌ Extract or store cookies
|
|
178
|
+
- ❌ Bypass authentication
|
|
179
|
+
- ❌ Circumvent anti-bot protections
|
|
180
|
+
- ❌ Automatically switch providers to evade rate limits
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Requirements
|
|
185
|
+
|
|
186
|
+
- Python **≥ 3.10**
|
|
187
|
+
- Google Chrome (with the PairIt extension loaded)
|
|
188
|
+
- Active browser sessions for the AI providers you intend to use
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Contributing
|
|
193
|
+
|
|
194
|
+
Contributions are welcome! For substantial changes, please open an issue first to discuss the proposed modification.
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
<p align="center">
|
|
199
|
+
Made with ❤️ by pAIrit contributors
|
|
200
|
+
</p>
|
pairit-0.4.0/README.md
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/naveenkumarr1812/PairIt/main/assets/logo.png" alt="pAIrit – Your Code. Your Browser. Your AI." width="600"/>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<strong>Turn your browser AI sessions into a local development interface</strong>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://pypi.org/project/pairit/"><img src="https://img.shields.io/pypi/v/pairit?color=7C3AED&label=PyPI&style=flat-square" alt="PyPI version"/></a>
|
|
11
|
+
<a href="https://pypi.org/project/pairit/"><img src="https://img.shields.io/pypi/pyversions/pairit?color=EA580C&style=flat-square" alt="Python versions"/></a>
|
|
12
|
+
<img src="https://img.shields.io/badge/Chrome%20Extension-MV3-4285F4?style=flat-square&logo=googlechrome&logoColor=white" alt="Chrome MV3"/>
|
|
13
|
+
<img src="https://img.shields.io/badge/license-MIT-22C55E?style=flat-square" alt="License MIT"/>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## What is pAIrit?
|
|
19
|
+
|
|
20
|
+
**pAIrit** is a developer-focused bridge that lets a local Python application talk to AI services — **ChatGPT, Claude, and Gemini** — through the browser tabs you already have open. No API keys, no separate billing; your Python code sends a request, pAIrit routes it to the right browser tab, and streams the answer back.
|
|
21
|
+
|
|
22
|
+
> **Note:** pAIrit is intended for local development workflows where the developer is already authenticated with the AI services in their browser.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## How It Works
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
Your Python Application
|
|
30
|
+
│
|
|
31
|
+
▼
|
|
32
|
+
pairit SDK (pip install pairit)
|
|
33
|
+
│
|
|
34
|
+
│ WebSocket
|
|
35
|
+
▼
|
|
36
|
+
Local pairit Bridge
|
|
37
|
+
│
|
|
38
|
+
│ Persistent connection
|
|
39
|
+
▼
|
|
40
|
+
PairIt Chrome Extension
|
|
41
|
+
┌────┴────┬───────┐
|
|
42
|
+
▼ ▼ ▼
|
|
43
|
+
ChatGPT Claude Gemini
|
|
44
|
+
(tab) (tab) (tab)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Design highlights:**
|
|
48
|
+
|
|
49
|
+
- Your app opens **one** WebSocket connection to the bridge — not a separate connection per provider.
|
|
50
|
+
- The extension locates a provider tab only when a request for that provider arrives.
|
|
51
|
+
- If the required tab is missing, PairIt returns a clear error:
|
|
52
|
+
`Claude is not open. Open Claude in a Chrome tab and try again.`
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Features
|
|
57
|
+
|
|
58
|
+
| Feature | Details |
|
|
59
|
+
|---|---|
|
|
60
|
+
| 🔄 **Multi-provider** | ChatGPT, Claude, Gemini — switch with one line |
|
|
61
|
+
| 📡 **Streaming** | Real-time browser-side streaming via DOM observer |
|
|
62
|
+
| 🔐 **No API keys** | Uses your existing logged-in browser sessions |
|
|
63
|
+
| 🪟 **Minimized Chrome** | Bridge stays alive even when Chrome is hidden |
|
|
64
|
+
| 🐍 **Python ≥ 3.10** | Async-first, built on `aiohttp` |
|
|
65
|
+
| 🧩 **Chrome MV3** | Modern Manifest V3 extension |
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Installation
|
|
70
|
+
|
|
71
|
+
### 1. Install the Python package
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
pip install pairit
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### 2. Load the Chrome extension
|
|
78
|
+
|
|
79
|
+
The easiest option is to install PairIt directly from the [Chrome Web Store](https://chromewebstore.google.com/detail/pair/pkcgibncheoddhpfieekkjdffpmmenie).
|
|
80
|
+
|
|
81
|
+
1. Open the [Chrome Web Store listing](https://chromewebstore.google.com/detail/pair/pkcgibncheoddhpfieekkjdffpmmenie).
|
|
82
|
+
2. Click **Add to Chrome** and confirm the installation.
|
|
83
|
+
3. Pin the **PairIt** extension to your toolbar.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Quick Start
|
|
88
|
+
|
|
89
|
+
### Basic request
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from pairit import Client
|
|
93
|
+
|
|
94
|
+
client = Client(provider="chatgpt")
|
|
95
|
+
|
|
96
|
+
try:
|
|
97
|
+
response = client.chat("Explain async programming in Python")
|
|
98
|
+
print(response.content)
|
|
99
|
+
finally:
|
|
100
|
+
client.close()
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Streaming
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
from pairit import Client
|
|
107
|
+
|
|
108
|
+
client = Client(provider="chatgpt")
|
|
109
|
+
|
|
110
|
+
try:
|
|
111
|
+
for chunk in client.chat("Explain Retrieval-Augmented Generation", stream=True):
|
|
112
|
+
print(chunk.content, end="", flush=True)
|
|
113
|
+
print()
|
|
114
|
+
finally:
|
|
115
|
+
client.close()
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
> `stream=False` (default) returns the full response after generation completes.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Developer Workflow
|
|
123
|
+
|
|
124
|
+
1. **Run** your Python script — the bridge starts automatically.
|
|
125
|
+
2. **Open** the required AI provider tabs in Chrome and stay logged in.
|
|
126
|
+
3. **Open** the PairIt extension popup and toggle it **ON**.
|
|
127
|
+
4. PairIt continuously attempts to connect to the bridge while the toggle is on.
|
|
128
|
+
5. **Send** requests from your code — pairit handles routing.
|
|
129
|
+
6. When finished, toggle the extension **OFF**.
|
|
130
|
+
|
|
131
|
+
> The extension does **not** auto-enable on a new Chrome session. You must turn it on manually to keep control explicit.
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Status Model
|
|
136
|
+
|
|
137
|
+
PairIt tracks two independent states:
|
|
138
|
+
|
|
139
|
+
| State | Description |
|
|
140
|
+
|---|---|
|
|
141
|
+
| **Bridge connection** | Local Python app ↔ Chrome extension (WebSocket) |
|
|
142
|
+
| **Provider availability** | Whether a ChatGPT / Claude / Gemini tab is currently open |
|
|
143
|
+
|
|
144
|
+
A provider does **not** need to be permanently connected — it only needs to be open at the moment a request targets it.
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Safety & Scope
|
|
149
|
+
|
|
150
|
+
pAIrit is a development-only tool. It **does not**:
|
|
151
|
+
|
|
152
|
+
- ❌ Extract or store cookies
|
|
153
|
+
- ❌ Bypass authentication
|
|
154
|
+
- ❌ Circumvent anti-bot protections
|
|
155
|
+
- ❌ Automatically switch providers to evade rate limits
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Requirements
|
|
160
|
+
|
|
161
|
+
- Python **≥ 3.10**
|
|
162
|
+
- Google Chrome (with the PairIt extension loaded)
|
|
163
|
+
- Active browser sessions for the AI providers you intend to use
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Contributing
|
|
168
|
+
|
|
169
|
+
Contributions are welcome! For substantial changes, please open an issue first to discuss the proposed modification.
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
<p align="center">
|
|
174
|
+
Made with ❤️ by pAIrit contributors
|
|
175
|
+
</p>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""Backward compatibility alias for pairit."""
|
|
2
|
+
from pairit import (
|
|
3
|
+
BridgeNotRunningError,
|
|
4
|
+
ChatChunk,
|
|
5
|
+
ChatResponse,
|
|
6
|
+
ChatTimeoutError,
|
|
7
|
+
Client,
|
|
8
|
+
ExtensionNotConnectedError,
|
|
9
|
+
PairError,
|
|
10
|
+
PairitError,
|
|
11
|
+
ProviderError,
|
|
12
|
+
ProviderNotOpenError,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"Client",
|
|
17
|
+
"ChatChunk",
|
|
18
|
+
"ChatResponse",
|
|
19
|
+
"PairitError",
|
|
20
|
+
"PairError",
|
|
21
|
+
"BridgeNotRunningError",
|
|
22
|
+
"ExtensionNotConnectedError",
|
|
23
|
+
"ProviderNotOpenError",
|
|
24
|
+
"ProviderError",
|
|
25
|
+
"ChatTimeoutError",
|
|
26
|
+
]
|