pinetext 0.1.0__tar.gz → 0.1.2__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.

Potentially problematic release.


This version of pinetext might be problematic. Click here for more details.

Files changed (37) hide show
  1. pinetext-0.1.2/.devcontainer/Dockerfilei +1 -0
  2. pinetext-0.1.2/.devcontainer/devcontainer.json +13 -0
  3. pinetext-0.1.2/.dockerignore +7 -0
  4. pinetext-0.1.2/.env.example +6 -0
  5. pinetext-0.1.2/.github/dependabot.yml +10 -0
  6. pinetext-0.1.2/.github/workflows/prod.yml +38 -0
  7. {pinetext-0.1.0 → pinetext-0.1.2}/.github/workflows/test.yml +1 -1
  8. pinetext-0.1.2/Dockerfile +20 -0
  9. pinetext-0.1.2/PKG-INFO +94 -0
  10. pinetext-0.1.2/README.md +80 -0
  11. pinetext-0.1.2/docker-compose.yml +16 -0
  12. pinetext-0.1.2/docs/docs.json +32 -0
  13. pinetext-0.1.2/docs/pinetext/installation.mdx +53 -0
  14. pinetext-0.1.2/docs/pinetext/introduction.mdx +6 -0
  15. {pinetext-0.1.0 → pinetext-0.1.2}/pyproject.toml +4 -1
  16. pinetext-0.1.2/src/pinetext/client.py +59 -0
  17. pinetext-0.1.2/src/pinetext/settings.py +25 -0
  18. pinetext-0.1.2/tests/client_test.py +25 -0
  19. pinetext-0.1.2/tests/conftest.py +60 -0
  20. pinetext-0.1.2/uv.lock +1475 -0
  21. pinetext-0.1.0/.env.example +0 -1
  22. pinetext-0.1.0/PKG-INFO +0 -15
  23. pinetext-0.1.0/README.md +0 -4
  24. pinetext-0.1.0/src/pinetext/client.py +0 -12
  25. pinetext-0.1.0/src/pinetext/settings.py +0 -10
  26. pinetext-0.1.0/tests/conftest.py +0 -12
  27. pinetext-0.1.0/uv.lock +0 -558
  28. {pinetext-0.1.0 → pinetext-0.1.2}/.github/workflows/codeql.yml +0 -0
  29. {pinetext-0.1.0 → pinetext-0.1.2}/.github/workflows/pypi.yml +0 -0
  30. {pinetext-0.1.0 → pinetext-0.1.2}/.gitignore +0 -0
  31. {pinetext-0.1.0 → pinetext-0.1.2}/.pre-commit-config.yaml +0 -0
  32. {pinetext-0.1.0 → pinetext-0.1.2}/.python-version +0 -0
  33. {pinetext-0.1.0 → pinetext-0.1.2}/LICENSE +0 -0
  34. {pinetext-0.1.0 → pinetext-0.1.2}/codecov.yml +0 -0
  35. {pinetext-0.1.0 → pinetext-0.1.2}/src/pinetext/__init__.py +0 -0
  36. {pinetext-0.1.0 → pinetext-0.1.2}/src/pinetext/cli.py +0 -0
  37. {pinetext-0.1.0 → pinetext-0.1.2}/tests/cli_test.py +0 -0
@@ -0,0 +1 @@
1
+ FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim
@@ -0,0 +1,13 @@
1
+ {
2
+ "build": {
3
+ "dockerfile": "Dockerfile"
4
+ },
5
+ "customizations": {
6
+ "vscode": {
7
+ "extensions": [
8
+ "ms-python.python",
9
+ "ms-python.vscode-pylance"
10
+ ]
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,7 @@
1
+ *
2
+ !Dockerfile
3
+ !pyproject.toml
4
+ !README.md
5
+ !uv.lock
6
+ !src/
7
+ !src/**
@@ -0,0 +1,6 @@
1
+ pinetext_pinecone__api_key=your-api-key
2
+ pinetext_pinecone__assistant=assistant-name
3
+ pinetext_pinecone__data_dir=data
4
+ pinetext_pinecone__model=o4-mini
5
+ pinetext_wandb__api_key=wandb-api-key
6
+ pinetext_wandb__project=pinetext
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "uv"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ groups:
8
+ all:
9
+ patterns:
10
+ - "*"
@@ -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@v4
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 }}
@@ -25,7 +25,7 @@ jobs:
25
25
  - run: |
26
26
  uv sync
27
27
  uv run pre-commit run --all-files
28
- uv run pytest --cov=bacnet_mcp --cov-report=xml
28
+ uv run pytest --cov=pinetext --cov-report=xml
29
29
  - uses: codecov/codecov-action@v5
30
30
  with:
31
31
  use_oidc: true
@@ -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"]
@@ -0,0 +1,94 @@
1
+ Metadata-Version: 2.4
2
+ Name: pinetext
3
+ Version: 0.1.2
4
+ Summary: PineText
5
+ License-File: LICENSE
6
+ Requires-Python: >=3.13
7
+ Requires-Dist: pinecone-plugin-assistant>=1.7.0
8
+ Requires-Dist: pinecone>=7.3.0
9
+ Requires-Dist: pydantic-settings>=2.10.1
10
+ Requires-Dist: typer>=0.16.0
11
+ Requires-Dist: wandb>=0.21.1
12
+ Requires-Dist: weave>=0.51.59
13
+ Description-Content-Type: text/markdown
14
+
15
+ ## PineText
16
+
17
+ [![test](https://github.com/ezhuk/pinetext/actions/workflows/test.yml/badge.svg)](https://github.com/ezhuk/pinetext/actions/workflows/test.yml)
18
+ [![codecov](https://codecov.io/github/ezhuk/pinetext/graph/badge.svg?token=0YJASFE5OM)](https://codecov.io/github/ezhuk/pinetext)
19
+ [![PyPI - Version](https://img.shields.io/pypi/v/pinetext.svg)](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).
@@ -0,0 +1,80 @@
1
+ ## PineText
2
+
3
+ [![test](https://github.com/ezhuk/pinetext/actions/workflows/test.yml/badge.svg)](https://github.com/ezhuk/pinetext/actions/workflows/test.yml)
4
+ [![codecov](https://codecov.io/github/ezhuk/pinetext/graph/badge.svg?token=0YJASFE5OM)](https://codecov.io/github/ezhuk/pinetext)
5
+ [![PyPI - Version](https://img.shields.io/pypi/v/pinetext.svg)](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.
@@ -1,13 +1,16 @@
1
1
  [project]
2
2
  name = "pinetext"
3
- version = "0.1.0"
3
+ version = "0.1.2"
4
4
  description = "PineText"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
7
7
  dependencies = [
8
8
  "pinecone>=7.3.0",
9
+ "pinecone-plugin-assistant>=1.7.0",
9
10
  "pydantic-settings>=2.10.1",
10
11
  "typer>=0.16.0",
12
+ "wandb>=0.21.1",
13
+ "weave>=0.51.59",
11
14
  ]
12
15
 
13
16
  [project.scripts]
@@ -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)
@@ -0,0 +1,25 @@
1
+ from pydantic import BaseModel
2
+ from pydantic_settings import BaseSettings, SettingsConfigDict
3
+
4
+
5
+ class Pinecone(BaseModel):
6
+ api_key: str | None = None
7
+ assistant: str | None = "test-assistant"
8
+ data_dir: str | None = "data"
9
+ model: str | None = "o4-mini"
10
+
11
+
12
+ class WandB(BaseModel):
13
+ api_key: str | None = None
14
+ project: str | None = "pinetext"
15
+
16
+
17
+ class Settings(BaseSettings):
18
+ pinecone: Pinecone = Pinecone()
19
+ wandb: WandB = WandB()
20
+ model_config = SettingsConfigDict(
21
+ env_file=".env",
22
+ env_file_encoding="utf-8",
23
+ env_nested_delimiter="__",
24
+ env_prefix="PINETEXT_",
25
+ )
@@ -0,0 +1,25 @@
1
+ import builtins
2
+
3
+
4
+ def test_get_or_create_assistant(pinetext):
5
+ assistant = pinetext.get_or_create_assistant("foo")
6
+ assert assistant is pinetext.pinecone.assistant
7
+
8
+
9
+ def test_upload_files(pinetext, tmp_path):
10
+ data = tmp_path / "data"
11
+ data.mkdir()
12
+ (data / "test.txt").write_text("TEST")
13
+ pinetext.upload_files(str(data))
14
+ assert "test.txt" in pinetext.pinecone.assistant.list_files()
15
+
16
+
17
+ def test_chat(pinetext):
18
+ resp = pinetext.chat("This is a test", model="test-model")
19
+ assert resp == "Test"
20
+
21
+
22
+ def test_run(pinetext, monkeypatch):
23
+ monkeypatch.setattr(builtins, "input", lambda prompt="": next(iter(["exit"])))
24
+ res = pinetext.run()
25
+ assert res is None
@@ -0,0 +1,60 @@
1
+ import pytest
2
+
3
+ from pathlib import Path
4
+
5
+ import pinetext.client as client_mod
6
+ from pinetext.client import PineText
7
+
8
+
9
+ @pytest.fixture
10
+ def cli(monkeypatch):
11
+ def dummy_run(self):
12
+ return
13
+
14
+ monkeypatch.setattr(
15
+ "pinetext.client.PineText.run",
16
+ dummy_run,
17
+ )
18
+
19
+
20
+ @pytest.fixture
21
+ def pinetext(monkeypatch):
22
+ class DummyAssistant:
23
+ def __init__(self):
24
+ self.files = []
25
+
26
+ def create_assistant(self, assistant_name: str, instructions: str = None):
27
+ return self
28
+
29
+ def describe_assistant(self, assistant_name: str):
30
+ return self
31
+
32
+ def list_files(self):
33
+ return self.files
34
+
35
+ def upload_file(self, file_path: str, metadata=None, timeout=None):
36
+ self.files.append(Path(file_path).name)
37
+
38
+ def chat(self, messages, model=None):
39
+ class Message:
40
+ def __init__(self, content):
41
+ self.content = content
42
+
43
+ class Response:
44
+ def __init__(self, content):
45
+ self.message = Message(content)
46
+
47
+ return Response("Test")
48
+
49
+ assistant = DummyAssistant()
50
+
51
+ class DummyPinecone:
52
+ def __init__(self, api_key):
53
+ self.assistant = assistant
54
+
55
+ monkeypatch.setattr(client_mod, "Pinecone", DummyPinecone)
56
+
57
+ client = PineText()
58
+ client.assistant = assistant
59
+ client.pinecone = DummyPinecone(None)
60
+ return client