pinetext 0.1.7__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.
- pinetext-0.1.7/.devcontainer/Dockerfile +5 -0
- pinetext-0.1.7/.devcontainer/devcontainer.json +14 -0
- pinetext-0.1.7/.devcontainer/post-create.sh +4 -0
- pinetext-0.1.7/.dockerignore +7 -0
- pinetext-0.1.7/.env.example +6 -0
- pinetext-0.1.7/.github/dependabot.yml +14 -0
- pinetext-0.1.7/.github/workflows/codeql.yml +39 -0
- pinetext-0.1.7/.github/workflows/prod.yml +38 -0
- pinetext-0.1.7/.github/workflows/pypi.yml +30 -0
- pinetext-0.1.7/.github/workflows/test.yml +31 -0
- pinetext-0.1.7/.gitignore +3 -0
- pinetext-0.1.7/.pre-commit-config.yaml +11 -0
- pinetext-0.1.7/.python-version +1 -0
- pinetext-0.1.7/Dockerfile +20 -0
- pinetext-0.1.7/LICENSE +21 -0
- pinetext-0.1.7/PKG-INFO +94 -0
- pinetext-0.1.7/README.md +80 -0
- pinetext-0.1.7/codecov.yml +3 -0
- pinetext-0.1.7/docker-compose.yml +16 -0
- pinetext-0.1.7/docs/docs.json +32 -0
- pinetext-0.1.7/docs/pinetext/installation.mdx +53 -0
- pinetext-0.1.7/docs/pinetext/introduction.mdx +6 -0
- pinetext-0.1.7/pyproject.toml +29 -0
- pinetext-0.1.7/src/pinetext/__init__.py +7 -0
- pinetext-0.1.7/src/pinetext/cli.py +15 -0
- pinetext-0.1.7/src/pinetext/client.py +59 -0
- pinetext-0.1.7/src/pinetext/settings.py +25 -0
- pinetext-0.1.7/tests/cli_test.py +9 -0
- pinetext-0.1.7/tests/client_test.py +25 -0
- pinetext-0.1.7/tests/conftest.py +60 -0
- pinetext-0.1.7/uv.lock +1657 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
multi-ecosystem-groups:
|
|
3
|
+
all:
|
|
4
|
+
schedule:
|
|
5
|
+
interval: "weekly"
|
|
6
|
+
updates:
|
|
7
|
+
- package-ecosystem: "uv"
|
|
8
|
+
directory: "/"
|
|
9
|
+
patterns: ["*"]
|
|
10
|
+
multi-ecosystem-group: "all"
|
|
11
|
+
- package-ecosystem: "github-actions"
|
|
12
|
+
directory: "/"
|
|
13
|
+
patterns: ["*"]
|
|
14
|
+
multi-ecosystem-group: "all"
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# codeql.yml
|
|
2
|
+
|
|
3
|
+
name: codeql
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
types: [opened, synchronize]
|
|
9
|
+
schedule:
|
|
10
|
+
- cron: '11 5 * * 3'
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
analyze:
|
|
14
|
+
name: Analyze (${{ matrix.language }})
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
permissions:
|
|
17
|
+
actions: read
|
|
18
|
+
contents: read
|
|
19
|
+
packages: read
|
|
20
|
+
security-events: write
|
|
21
|
+
|
|
22
|
+
strategy:
|
|
23
|
+
fail-fast: false
|
|
24
|
+
matrix:
|
|
25
|
+
include:
|
|
26
|
+
- language: actions
|
|
27
|
+
build-mode: none
|
|
28
|
+
- language: python
|
|
29
|
+
build-mode: none
|
|
30
|
+
|
|
31
|
+
steps:
|
|
32
|
+
- uses: actions/checkout@v6
|
|
33
|
+
- uses: github/codeql-action/init@v4
|
|
34
|
+
with:
|
|
35
|
+
languages: ${{ matrix.language }}
|
|
36
|
+
build-mode: ${{ matrix.build-mode }}
|
|
37
|
+
- uses: github/codeql-action/analyze@v4
|
|
38
|
+
with:
|
|
39
|
+
category: "/language:${{matrix.language}}"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# prod.yml
|
|
2
|
+
|
|
3
|
+
name: prod
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
release:
|
|
7
|
+
types: [created]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
publish:
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
packages: write
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v6
|
|
18
|
+
- uses: docker/login-action@v3
|
|
19
|
+
with:
|
|
20
|
+
registry: ghcr.io
|
|
21
|
+
username: ${{ github.actor }}
|
|
22
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
23
|
+
- name: Metadata
|
|
24
|
+
id: meta
|
|
25
|
+
uses: docker/metadata-action@v5
|
|
26
|
+
with:
|
|
27
|
+
images: ghcr.io/ezhuk/pinetext
|
|
28
|
+
tags: |
|
|
29
|
+
type=semver,pattern={{version}}
|
|
30
|
+
type=semver,pattern=latest
|
|
31
|
+
- uses: docker/setup-buildx-action@v3
|
|
32
|
+
- uses: docker/build-push-action@v6
|
|
33
|
+
with:
|
|
34
|
+
cache-from: type=gha
|
|
35
|
+
cache-to: type=gha,mode=max
|
|
36
|
+
context: .
|
|
37
|
+
push: true
|
|
38
|
+
tags: ${{ steps.meta.outputs.tags }}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# pypi.yml
|
|
2
|
+
|
|
3
|
+
name: pypi
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
release:
|
|
7
|
+
types: [published]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
publish:
|
|
12
|
+
environment:
|
|
13
|
+
name: pypi
|
|
14
|
+
url: https://pypi.org/p/pinetext
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
id-token: write
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v6
|
|
22
|
+
- uses: astral-sh/setup-uv@v7
|
|
23
|
+
- uses: actions/setup-python@v6
|
|
24
|
+
with:
|
|
25
|
+
python-version-file: .python-version
|
|
26
|
+
- run: |
|
|
27
|
+
uv build
|
|
28
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
29
|
+
with:
|
|
30
|
+
packages-dir: dist/
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# test.yml
|
|
2
|
+
|
|
3
|
+
name: test
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
types: [opened, synchronize]
|
|
9
|
+
push:
|
|
10
|
+
branches: [main]
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
id-token: write
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v6
|
|
21
|
+
- uses: astral-sh/setup-uv@v7
|
|
22
|
+
- uses: actions/setup-python@v6
|
|
23
|
+
with:
|
|
24
|
+
python-version-file: .python-version
|
|
25
|
+
- run: |
|
|
26
|
+
uv sync
|
|
27
|
+
uv run pre-commit run --all-files
|
|
28
|
+
uv run pytest --cov=pinetext --cov-report=xml
|
|
29
|
+
- uses: codecov/codecov-action@v5
|
|
30
|
+
with:
|
|
31
|
+
use_oidc: true
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim
|
|
2
|
+
|
|
3
|
+
WORKDIR /app
|
|
4
|
+
|
|
5
|
+
ENV UV_COMPILE_BYTECODE=1 \
|
|
6
|
+
UV_LINK_MODE=copy
|
|
7
|
+
|
|
8
|
+
COPY pyproject.toml README.md uv.lock ./
|
|
9
|
+
|
|
10
|
+
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
11
|
+
uv sync --locked --no-install-project --no-dev
|
|
12
|
+
|
|
13
|
+
COPY src /app/src
|
|
14
|
+
|
|
15
|
+
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
16
|
+
uv sync --locked --no-dev
|
|
17
|
+
|
|
18
|
+
ENV PATH="/app/.venv/bin:$PATH"
|
|
19
|
+
|
|
20
|
+
ENTRYPOINT ["pinetext"]
|
pinetext-0.1.7/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Eugene Zhuk
|
|
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.
|
pinetext-0.1.7/PKG-INFO
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pinetext
|
|
3
|
+
Version: 0.1.7
|
|
4
|
+
Summary: PineText
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Requires-Python: >=3.13
|
|
7
|
+
Requires-Dist: pinecone-plugin-assistant>=3.0.0
|
|
8
|
+
Requires-Dist: pinecone>=8.0.0
|
|
9
|
+
Requires-Dist: pydantic-settings>=2.12.0
|
|
10
|
+
Requires-Dist: typer>=0.21.0
|
|
11
|
+
Requires-Dist: wandb>=0.23.1
|
|
12
|
+
Requires-Dist: weave>=0.52.23
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
## PineText
|
|
16
|
+
|
|
17
|
+
[](https://github.com/ezhuk/pinetext/actions/workflows/test.yml)
|
|
18
|
+
[](https://codecov.io/github/ezhuk/pinetext)
|
|
19
|
+
[](https://pypi.org/p/pinetext)
|
|
20
|
+
|
|
21
|
+
A lightweight assistant built using [Pinecone](https://docs.pinecone.io/guides/assistant/overview) that helps create RAG-based chat applications for reasoning over documents, retrieving relevant context, and providing grounded answers.
|
|
22
|
+
|
|
23
|
+
## Getting Started
|
|
24
|
+
|
|
25
|
+
Use [uv](https://github.com/astral-sh/uv) to add and manage PineText as a dependency in your project, or install it directly via `uv pip install` or `pip install`. See the [Installation](https://github.com/ezhuk/pinetext/blob/main/docs/pinetext/installation.mdx) section of the documentation for full installation instructions and more details.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
uv add pinetext
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
It can be embedded in and run directly from your application.
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
# app.py
|
|
35
|
+
from pinetext import PineText
|
|
36
|
+
|
|
37
|
+
def main():
|
|
38
|
+
pt = PineText()
|
|
39
|
+
pt.run()
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
It can also be launched from the command line using the provided `CLI` without modifying the source code.
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
pinetext
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Or in an ephemeral, isolated environment using `uvx`. Check out the [Using tools](https://docs.astral.sh/uv/guides/tools/) guide for more details.
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
uvx pinetext
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Configuration
|
|
55
|
+
|
|
56
|
+
Place documents in the `data` folder and make sure to set `PINECONE_API_KEY` and the assistant name before starting PineText.
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
export PINETEXT_PINECONE__API_KEY=your-api-key
|
|
60
|
+
export PINETEXT_PINECONE__ASSISTANT=assistant-name
|
|
61
|
+
export PINETEXT_PINECONE__DATA_DIR=data
|
|
62
|
+
export PINETEXT_PINECONE__MODEL=o4-mini
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
These settings can also be specified in a `.env` file in the working directory.
|
|
66
|
+
|
|
67
|
+
```text
|
|
68
|
+
pinetext_pinecone__api_key=your-api-key
|
|
69
|
+
pinetext_pinecone__assistant=assistant-name
|
|
70
|
+
pinetext_pinecone__data_dir=data
|
|
71
|
+
pinetext_pinecone__model=o4-mini
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Docker
|
|
75
|
+
|
|
76
|
+
The PineText CLI can be deployed as a Docker container as follows:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
docker run -it \
|
|
80
|
+
--name pinetext \
|
|
81
|
+
--env-file .env \
|
|
82
|
+
-v $(pwd)/data:/app/data
|
|
83
|
+
ghcr.io/ezhuk/pinetext:latest
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Or using Docker Compose:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
docker compose up
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
The server is licensed under the [MIT License](https://github.com/ezhuk/pinetext?tab=MIT-1-ov-file).
|
pinetext-0.1.7/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
## PineText
|
|
2
|
+
|
|
3
|
+
[](https://github.com/ezhuk/pinetext/actions/workflows/test.yml)
|
|
4
|
+
[](https://codecov.io/github/ezhuk/pinetext)
|
|
5
|
+
[](https://pypi.org/p/pinetext)
|
|
6
|
+
|
|
7
|
+
A lightweight assistant built using [Pinecone](https://docs.pinecone.io/guides/assistant/overview) that helps create RAG-based chat applications for reasoning over documents, retrieving relevant context, and providing grounded answers.
|
|
8
|
+
|
|
9
|
+
## Getting Started
|
|
10
|
+
|
|
11
|
+
Use [uv](https://github.com/astral-sh/uv) to add and manage PineText as a dependency in your project, or install it directly via `uv pip install` or `pip install`. See the [Installation](https://github.com/ezhuk/pinetext/blob/main/docs/pinetext/installation.mdx) section of the documentation for full installation instructions and more details.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
uv add pinetext
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
It can be embedded in and run directly from your application.
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
# app.py
|
|
21
|
+
from pinetext import PineText
|
|
22
|
+
|
|
23
|
+
def main():
|
|
24
|
+
pt = PineText()
|
|
25
|
+
pt.run()
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
It can also be launched from the command line using the provided `CLI` without modifying the source code.
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
pinetext
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Or in an ephemeral, isolated environment using `uvx`. Check out the [Using tools](https://docs.astral.sh/uv/guides/tools/) guide for more details.
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
uvx pinetext
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Configuration
|
|
41
|
+
|
|
42
|
+
Place documents in the `data` folder and make sure to set `PINECONE_API_KEY` and the assistant name before starting PineText.
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
export PINETEXT_PINECONE__API_KEY=your-api-key
|
|
46
|
+
export PINETEXT_PINECONE__ASSISTANT=assistant-name
|
|
47
|
+
export PINETEXT_PINECONE__DATA_DIR=data
|
|
48
|
+
export PINETEXT_PINECONE__MODEL=o4-mini
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
These settings can also be specified in a `.env` file in the working directory.
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
pinetext_pinecone__api_key=your-api-key
|
|
55
|
+
pinetext_pinecone__assistant=assistant-name
|
|
56
|
+
pinetext_pinecone__data_dir=data
|
|
57
|
+
pinetext_pinecone__model=o4-mini
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Docker
|
|
61
|
+
|
|
62
|
+
The PineText CLI can be deployed as a Docker container as follows:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
docker run -it \
|
|
66
|
+
--name pinetext \
|
|
67
|
+
--env-file .env \
|
|
68
|
+
-v $(pwd)/data:/app/data
|
|
69
|
+
ghcr.io/ezhuk/pinetext:latest
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Or using Docker Compose:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
docker compose up
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
The server is licensed under the [MIT License](https://github.com/ezhuk/pinetext?tab=MIT-1-ov-file).
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
services:
|
|
2
|
+
pinetext:
|
|
3
|
+
build: .
|
|
4
|
+
container_name: pinetext
|
|
5
|
+
restart: unless-stopped
|
|
6
|
+
env_file:
|
|
7
|
+
- .env
|
|
8
|
+
environment:
|
|
9
|
+
- pinetext_pinecone__api_key=${pinetext_pinecone__api_key:-}
|
|
10
|
+
- pinetext_pinecone__assistant=${pinetext_pinecone__assistant:-assistant-name}
|
|
11
|
+
- pinetext_pinecone__model=${pinetext_pinecone__model:-o4-mini}
|
|
12
|
+
- pinetext_pinecone__data_dir=/app/data
|
|
13
|
+
volumes:
|
|
14
|
+
- ${pinetext_pinecone__data_dir:-./data}:/app/data
|
|
15
|
+
stdin_open: true
|
|
16
|
+
tty: true
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://mintlify.com/docs.json",
|
|
3
|
+
"colors": {
|
|
4
|
+
"primary": "#16A34A",
|
|
5
|
+
"light": "#07C983",
|
|
6
|
+
"dark": "#15803D"
|
|
7
|
+
},
|
|
8
|
+
"description": "",
|
|
9
|
+
"icons": {
|
|
10
|
+
"library": "lucide"
|
|
11
|
+
},
|
|
12
|
+
"name": "Docs",
|
|
13
|
+
"navigation": {
|
|
14
|
+
"dropdowns": [
|
|
15
|
+
{
|
|
16
|
+
"dropdown": "PineText Assistant",
|
|
17
|
+
"description": "Reason over documents",
|
|
18
|
+
"icon": "file-search",
|
|
19
|
+
"groups": [
|
|
20
|
+
{
|
|
21
|
+
"group": "Getting Started",
|
|
22
|
+
"pages": [
|
|
23
|
+
"pinetext/introduction",
|
|
24
|
+
"pinetext/installation"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"theme": "maple"
|
|
32
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Installation
|
|
3
|
+
icon: terminal
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Use [uv](https://github.com/astral-sh/uv) to add and manage PineText as a dependency in your project, or install it directly via `uv pip install` or `pip install`. See the [Installation](https://github.com/ezhuk/modbus-mcp/blob/main/docs/modbus-mcp/installation.mdx) section of the documentation for full installation instructions and more details.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
uv add pinetext
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
It can be embedded in and run directly from your application.
|
|
13
|
+
|
|
14
|
+
```python
|
|
15
|
+
# app.py
|
|
16
|
+
from pinetext import PineText
|
|
17
|
+
|
|
18
|
+
def main():
|
|
19
|
+
pt = PineText()
|
|
20
|
+
pt.run()
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
It can also be launched from the command line using the provided `CLI` without modifying the source code.
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
pinetext
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Or in an ephemeral, isolated environment using `uvx`. Check out the [Using tools](https://docs.astral.sh/uv/guides/tools/) guide for more details.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
uvx pinetext
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Configuration
|
|
36
|
+
|
|
37
|
+
Place documents in the `data` folder and make sure to set `PINECONE_API_KEY` and the assistant name before starting PineText.
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
export PINETEXT_PINECONE__API_KEY=your-api-key
|
|
41
|
+
export PINETEXT_PINECONE__ASSISTANT=assistant-name
|
|
42
|
+
export PINETEXT_PINECONE__DATA_DIR=data
|
|
43
|
+
export PINETEXT_PINECONE__MODEL=o4-mini
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
These settings can also be specified in a `.env` file in the working directory.
|
|
47
|
+
|
|
48
|
+
```text
|
|
49
|
+
pinetext_pinecone__api_key=your-api-key
|
|
50
|
+
pinetext_pinecone__assistant=assistant-name
|
|
51
|
+
pinetext_pinecone__data_dir=data
|
|
52
|
+
pinetext_pinecone__model=o4-mini
|
|
53
|
+
```
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Introduction
|
|
3
|
+
icon: book-open
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
PineText is a lightweight assistant built using [Pinecone](https://docs.pinecone.io/guides/assistant/overview) that helps create RAG-based chat applications for reasoning over documents, retrieving relevant context, and providing grounded answers.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "pinetext"
|
|
3
|
+
version = "0.1.7"
|
|
4
|
+
description = "PineText"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.13"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"pinecone>=8.0.0",
|
|
9
|
+
"pinecone-plugin-assistant>=3.0.0",
|
|
10
|
+
"pydantic-settings>=2.12.0",
|
|
11
|
+
"typer>=0.21.0",
|
|
12
|
+
"wandb>=0.23.1",
|
|
13
|
+
"weave>=0.52.23",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
[project.scripts]
|
|
17
|
+
pinetext = "pinetext.cli:app"
|
|
18
|
+
|
|
19
|
+
[build-system]
|
|
20
|
+
requires = ["hatchling"]
|
|
21
|
+
build-backend = "hatchling.build"
|
|
22
|
+
|
|
23
|
+
[dependency-groups]
|
|
24
|
+
dev = [
|
|
25
|
+
"pre-commit>=4.2.0",
|
|
26
|
+
"pytest>=8.4.1",
|
|
27
|
+
"pytest-cov>=6.2.1",
|
|
28
|
+
"ruff>=0.12.4",
|
|
29
|
+
]
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import wandb
|
|
2
|
+
import weave
|
|
3
|
+
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
from pinecone import Pinecone
|
|
7
|
+
from pinecone_plugins.assistant.models.chat import Message
|
|
8
|
+
|
|
9
|
+
from pinetext.settings import Settings
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
settings = Settings()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class PineText:
|
|
16
|
+
def __init__(self):
|
|
17
|
+
pass
|
|
18
|
+
|
|
19
|
+
def get_or_create_assistant(self, name: str):
|
|
20
|
+
try:
|
|
21
|
+
return self.pinecone.assistant.describe_assistant(assistant_name=name)
|
|
22
|
+
except Exception:
|
|
23
|
+
return self.pinecone.assistant.create_assistant(assistant_name=name)
|
|
24
|
+
|
|
25
|
+
def upload_files(self, path: str):
|
|
26
|
+
folder = Path(path)
|
|
27
|
+
if folder.is_dir():
|
|
28
|
+
uploaded = [x.name for x in self.assistant.list_files()]
|
|
29
|
+
for x in sorted(folder.iterdir()):
|
|
30
|
+
if x.name not in uploaded:
|
|
31
|
+
self.assistant.upload_file(
|
|
32
|
+
file_path=str(x.resolve()),
|
|
33
|
+
metadata={
|
|
34
|
+
"filename": x.name,
|
|
35
|
+
"extension": x.suffix.lower().lstrip("."),
|
|
36
|
+
},
|
|
37
|
+
timeout=None,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
@weave.op()
|
|
41
|
+
def chat(self, text: str, model: str):
|
|
42
|
+
msg = Message(role="user", content=text)
|
|
43
|
+
resp = self.assistant.chat(messages=[msg], model=model)
|
|
44
|
+
return resp.message.content
|
|
45
|
+
|
|
46
|
+
def run(self):
|
|
47
|
+
if settings.wandb.api_key:
|
|
48
|
+
wandb.login(key=settings.wandb.api_key)
|
|
49
|
+
weave.init(settings.wandb.project)
|
|
50
|
+
self.pinecone = Pinecone(api_key=settings.pinecone.api_key)
|
|
51
|
+
self.assistant = self.get_or_create_assistant(settings.pinecone.assistant)
|
|
52
|
+
self.upload_files(settings.pinecone.data_dir)
|
|
53
|
+
|
|
54
|
+
while True:
|
|
55
|
+
text = input("> ").strip()
|
|
56
|
+
if text.lower() in ("exit", "quit"):
|
|
57
|
+
break
|
|
58
|
+
res = self.chat(text, settings.pinecone.model)
|
|
59
|
+
print(res)
|