docpilot-cli 1.0.1__tar.gz → 1.0.3__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.
Files changed (20) hide show
  1. {docpilot_cli-1.0.1 → docpilot_cli-1.0.3}/PKG-INFO +20 -2
  2. {docpilot_cli-1.0.1 → docpilot_cli-1.0.3}/README.md +20 -2
  3. {docpilot_cli-1.0.1 → docpilot_cli-1.0.3}/pyproject.toml +1 -1
  4. docpilot_cli-1.0.3/src/docpilot/__main__.py +4 -0
  5. {docpilot_cli-1.0.1 → docpilot_cli-1.0.3}/src/docpilot/chat.py +16 -3
  6. {docpilot_cli-1.0.1 → docpilot_cli-1.0.3}/src/docpilot/cli.py +27 -15
  7. {docpilot_cli-1.0.1 → docpilot_cli-1.0.3}/src/docpilot_cli.egg-info/PKG-INFO +20 -2
  8. {docpilot_cli-1.0.1 → docpilot_cli-1.0.3}/src/docpilot_cli.egg-info/SOURCES.txt +1 -0
  9. {docpilot_cli-1.0.1 → docpilot_cli-1.0.3}/LICENSE +0 -0
  10. {docpilot_cli-1.0.1 → docpilot_cli-1.0.3}/setup.cfg +0 -0
  11. {docpilot_cli-1.0.1 → docpilot_cli-1.0.3}/src/docpilot/__init__.py +0 -0
  12. {docpilot_cli-1.0.1 → docpilot_cli-1.0.3}/src/docpilot/embed.py +0 -0
  13. {docpilot_cli-1.0.1 → docpilot_cli-1.0.3}/src/docpilot/scrape.py +0 -0
  14. {docpilot_cli-1.0.1 → docpilot_cli-1.0.3}/src/docpilot/store.py +0 -0
  15. {docpilot_cli-1.0.1 → docpilot_cli-1.0.3}/src/docpilot_cli.egg-info/dependency_links.txt +0 -0
  16. {docpilot_cli-1.0.1 → docpilot_cli-1.0.3}/src/docpilot_cli.egg-info/entry_points.txt +0 -0
  17. {docpilot_cli-1.0.1 → docpilot_cli-1.0.3}/src/docpilot_cli.egg-info/requires.txt +0 -0
  18. {docpilot_cli-1.0.1 → docpilot_cli-1.0.3}/src/docpilot_cli.egg-info/top_level.txt +0 -0
  19. {docpilot_cli-1.0.1 → docpilot_cli-1.0.3}/tests/test_cli.py +0 -0
  20. {docpilot_cli-1.0.1 → docpilot_cli-1.0.3}/tests/test_store.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: docpilot-cli
3
- Version: 1.0.1
3
+ Version: 1.0.3
4
4
  Summary: A local-first RAG pipeline CLI tool
5
5
  Requires-Python: >=3.12
6
6
  Description-Content-Type: text/markdown
@@ -59,9 +59,11 @@ pip install "docpilot-cli[pdf]"
59
59
  ```
60
60
 
61
61
  ### Prerequisites
62
+
62
63
  1. **Python 3.12+**
63
64
  2. **[Ollama](https://ollama.com/)**: Installed and running in the background.
64
65
  3. Pull your preferred models:
66
+
65
67
  ```bash
66
68
  ollama pull qwen2.5:latest
67
69
  ollama pull mxbai-embed-large:335m
@@ -71,9 +73,10 @@ ollama pull mxbai-embed-large:335m
71
73
 
72
74
  ## 🛠️ Quick Start
73
75
 
74
- The very first time you run a DocPilot command, it will launch the **Interactive Setup Wizard** to help you configure your chat and embedding models.
76
+ The very first time you run a DocPilot command, it will launch the **Interactive Setup Wizard** to help you configure your chat and embedding models.
75
77
 
76
78
  ### 1. Ingest Knowledge
79
+
77
80
  Point DocPilot to any documentation site, sitemap, PDF, or CSV:
78
81
 
79
82
  ```bash
@@ -87,7 +90,11 @@ docpilot ingest "./docs/engineering_handbook.pdf"
87
90
  docpilot ingest "./data/faq.csv"
88
91
  ```
89
92
 
93
+ > [!TIP]
94
+ > If you installed via standard `pip` and get a "command not found" error because your binary path isn't configured, you can always run docpilot by prefixing commands with `python -m docpilot` (e.g., `python -m docpilot ingest ...`).
95
+
90
96
  ### 2. Ask Questions
97
+
91
98
  Query your newly created local knowledge base:
92
99
 
93
100
  ```bash
@@ -101,26 +108,34 @@ docpilot ask "How do I create a virtual environment?"
101
108
  Manage your configuration, models, and local database with ease.
102
109
 
103
110
  ### `docpilot setup`
111
+
104
112
  Re-run the interactive setup wizard at any time to change your default models.
105
113
 
106
114
  ### `docpilot project`
115
+
107
116
  Switch to a different project or check the active project. Each project has its own isolated vector database.
117
+
108
118
  ```bash
109
119
  docpilot project
110
120
  docpilot project <project-name>
111
121
  ```
112
122
 
113
123
  ### `docpilot clear`
124
+
114
125
  Wipe your local Chroma vector database to start fresh. Prompts for safety confirmation.
115
126
 
116
127
  ### `docpilot speed [profile]`
128
+
117
129
  Adjust the retrieval and generation settings for your desired use case.
130
+
118
131
  - `fast`: Lower latency, shorter context limits.
119
132
  - `balanced`: Default trade-off.
120
133
  - `quality`: Larger context, more comprehensive answers, slower inference.
121
134
 
122
135
  ### `docpilot model`
136
+
123
137
  Manually manage your Ollama models without the interactive setup wizard.
138
+
124
139
  ```bash
125
140
  docpilot model list
126
141
  docpilot model set <chat-model>
@@ -128,9 +143,11 @@ docpilot model setembed <embedding-model>
128
143
  ```
129
144
 
130
145
  ### `docpilot render`
146
+
131
147
  Parse and beautifully render any markdown file or text string directly in your terminal.
132
148
 
133
149
  ### `docpilot show`
150
+
134
151
  Display your current project version and configuration in beautiful ASCII art.
135
152
 
136
153
  ---
@@ -153,6 +170,7 @@ DocPilot employs an optimized RAG (Retrieval-Augmented Generation) pipeline:
153
170
  Contributions are welcome! If you are using DocPilot for your daily workflows or in a hackathon, feel free to open issues and pull requests.
154
171
 
155
172
  To set up a local development environment:
173
+
156
174
  ```bash
157
175
  git clone https://github.com/yourusername/docpilot.git
158
176
  cd docpilot
@@ -37,9 +37,11 @@ pip install "docpilot-cli[pdf]"
37
37
  ```
38
38
 
39
39
  ### Prerequisites
40
+
40
41
  1. **Python 3.12+**
41
42
  2. **[Ollama](https://ollama.com/)**: Installed and running in the background.
42
43
  3. Pull your preferred models:
44
+
43
45
  ```bash
44
46
  ollama pull qwen2.5:latest
45
47
  ollama pull mxbai-embed-large:335m
@@ -49,9 +51,10 @@ ollama pull mxbai-embed-large:335m
49
51
 
50
52
  ## 🛠️ Quick Start
51
53
 
52
- The very first time you run a DocPilot command, it will launch the **Interactive Setup Wizard** to help you configure your chat and embedding models.
54
+ The very first time you run a DocPilot command, it will launch the **Interactive Setup Wizard** to help you configure your chat and embedding models.
53
55
 
54
56
  ### 1. Ingest Knowledge
57
+
55
58
  Point DocPilot to any documentation site, sitemap, PDF, or CSV:
56
59
 
57
60
  ```bash
@@ -65,7 +68,11 @@ docpilot ingest "./docs/engineering_handbook.pdf"
65
68
  docpilot ingest "./data/faq.csv"
66
69
  ```
67
70
 
71
+ > [!TIP]
72
+ > If you installed via standard `pip` and get a "command not found" error because your binary path isn't configured, you can always run docpilot by prefixing commands with `python -m docpilot` (e.g., `python -m docpilot ingest ...`).
73
+
68
74
  ### 2. Ask Questions
75
+
69
76
  Query your newly created local knowledge base:
70
77
 
71
78
  ```bash
@@ -79,26 +86,34 @@ docpilot ask "How do I create a virtual environment?"
79
86
  Manage your configuration, models, and local database with ease.
80
87
 
81
88
  ### `docpilot setup`
89
+
82
90
  Re-run the interactive setup wizard at any time to change your default models.
83
91
 
84
92
  ### `docpilot project`
93
+
85
94
  Switch to a different project or check the active project. Each project has its own isolated vector database.
95
+
86
96
  ```bash
87
97
  docpilot project
88
98
  docpilot project <project-name>
89
99
  ```
90
100
 
91
101
  ### `docpilot clear`
102
+
92
103
  Wipe your local Chroma vector database to start fresh. Prompts for safety confirmation.
93
104
 
94
105
  ### `docpilot speed [profile]`
106
+
95
107
  Adjust the retrieval and generation settings for your desired use case.
108
+
96
109
  - `fast`: Lower latency, shorter context limits.
97
110
  - `balanced`: Default trade-off.
98
111
  - `quality`: Larger context, more comprehensive answers, slower inference.
99
112
 
100
113
  ### `docpilot model`
114
+
101
115
  Manually manage your Ollama models without the interactive setup wizard.
116
+
102
117
  ```bash
103
118
  docpilot model list
104
119
  docpilot model set <chat-model>
@@ -106,9 +121,11 @@ docpilot model setembed <embedding-model>
106
121
  ```
107
122
 
108
123
  ### `docpilot render`
124
+
109
125
  Parse and beautifully render any markdown file or text string directly in your terminal.
110
126
 
111
127
  ### `docpilot show`
128
+
112
129
  Display your current project version and configuration in beautiful ASCII art.
113
130
 
114
131
  ---
@@ -131,6 +148,7 @@ DocPilot employs an optimized RAG (Retrieval-Augmented Generation) pipeline:
131
148
  Contributions are welcome! If you are using DocPilot for your daily workflows or in a hackathon, feel free to open issues and pull requests.
132
149
 
133
150
  To set up a local development environment:
151
+
134
152
  ```bash
135
153
  git clone https://github.com/yourusername/docpilot.git
136
154
  cd docpilot
@@ -142,4 +160,4 @@ uv run pytest
142
160
 
143
161
  ## 📄 License
144
162
 
145
- This project is licensed under the MIT License.
163
+ This project is licensed under the MIT License.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "docpilot-cli"
3
- version = "1.0.1"
3
+ version = "1.0.3"
4
4
  description = "A local-first RAG pipeline CLI tool"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -0,0 +1,4 @@
1
+ from docpilot.cli import app
2
+
3
+ if __name__ == "__main__":
4
+ app()
@@ -1,5 +1,6 @@
1
1
  from langchain_ollama.llms import OllamaLLM as Ollama
2
2
  from langchain_core.prompts import ChatPromptTemplate
3
+ from langchain_core.output_parsers import StrOutputParser
3
4
  import os
4
5
  from . import store
5
6
  from langchain_chroma import Chroma
@@ -18,16 +19,23 @@ model = Ollama(
18
19
  temperature=float(config.get("temperature", 0.1)),
19
20
  )
20
21
 
21
-
22
22
  def _get_vectorstore():
23
23
  """Get vectorstore for the active project."""
24
24
  embeddings = OllamaEmbeddings(model=config.get("default_embed_model", "mxbai-embed-large:335m"))
25
25
  db_location = store.get_active_project_path()
26
26
  return Chroma(collection_name="documents", persist_directory=str(db_location), embedding_function=embeddings)
27
27
 
28
-
29
28
  retriever = None
30
29
 
30
+ # Query Transformation Chain
31
+ rewrite_template = """You are an AI assistant helping to formulate a search query for a vector database.
32
+ Given the user's vague or short input, rewrite it into a precise search query or a set of keywords that will be used to retrieve relevant documents.
33
+ Just output the query, do not add any explanation or conversational text.
34
+ User input: {question}
35
+ Search query:"""
36
+ rewrite_prompt = ChatPromptTemplate.from_template(rewrite_template)
37
+ rewrite_chain = rewrite_prompt | model | StrOutputParser()
38
+
31
39
  template = """
32
40
  You are an assistant for answering questions based on the following ingested documents.
33
41
  Use the information in the documents to answer the question as best as you can.
@@ -59,12 +67,17 @@ def _build_bounded_context(docs, max_total_chars: int = 6000, max_doc_chars: int
59
67
  def askai(question):
60
68
  vectorstore = _get_vectorstore()
61
69
  retriever = vectorstore.as_retriever(search_kwargs={"k": retrieval_k})
62
- rag = retriever.invoke(question)
70
+
71
+ # Rewrite the vague prompt into keywords/search query before hitting the vector DB
72
+ search_query = rewrite_chain.invoke({"question": question}).strip()
73
+ rag = retriever.invoke(search_query)
63
74
  rag_text = _build_bounded_context(
64
75
  rag,
65
76
  max_total_chars=max_context_chars,
66
77
  max_doc_chars=max_doc_chars,
67
78
  )
79
+ if rag_text == "":
80
+ print("NO RAG obtained add some documents to ingest")
68
81
  result = chain.invoke({"reviews": rag_text, "question": question})
69
82
  return result
70
83
 
@@ -20,11 +20,18 @@ console = Console()
20
20
 
21
21
  app = typer.Typer()
22
22
 
23
- # Project metadata
24
- PROJECT_VERSION = "1.0.0"
25
- PROJECT_NAME = "docpilot"
26
- PROJECT_DESCRIPTION = "A local-first RAG pipeline CLI tool"
23
+ from importlib.metadata import version, metadata, PackageNotFoundError
27
24
 
25
+ # Project metadata
26
+ try:
27
+ PROJECT_VERSION = version("docpilot-cli")
28
+ meta = metadata("docpilot-cli")
29
+ PROJECT_NAME = meta.get("Name", "docpilot")
30
+ PROJECT_DESCRIPTION = meta.get("Summary", "A local-first RAG pipeline CLI tool")
31
+ except PackageNotFoundError:
32
+ PROJECT_VERSION = "unknown"
33
+ PROJECT_NAME = "docpilot"
34
+ PROJECT_DESCRIPTION = "A local-first RAG pipeline CLI tool"
28
35
 
29
36
  @app.command()
30
37
  def project(
@@ -92,15 +99,15 @@ def generate_ascii_art() -> str:
92
99
  try:
93
100
  import pyfiglet
94
101
 
95
- ascii_text = pyfiglet.figlet_format(PROJECT_NAME, font="banner")
102
+ ascii_text = pyfiglet.figlet_format(PROJECT_NAME, font="slant")
96
103
  except ImportError:
97
104
  # Fallback to simple ASCII if pyfiglet not available
98
105
  ascii_text = """
99
- ____ ____ _ _ _
100
- / __ \\___ _____/ __ \\(_) | | |
101
- / / / / _ \\/ ___/ /_/ / /| | | |
102
- / /_/ / __/ /__/ ____/ / | |___ |_|
103
- /_____/\\___/\\___/_/ /_/ |_____/ (_)
106
+ ____ ____ _ __ __
107
+ / __ \\____ _____/ __ \\(_) /___ / /
108
+ / / / / __ \\/ ___/ /_/ / / / __ \\/ /
109
+ / /_/ / /_/ / /__/ ____/ / / /_/ / /
110
+ /_____/\\____/\\___/_/ /_/_/\\____/_/
104
111
  """
105
112
  return ascii_text
106
113
 
@@ -109,11 +116,16 @@ def generate_ascii_art() -> str:
109
116
  def show():
110
117
  """Display version and project information in beautiful ASCII art."""
111
118
  ascii_art = generate_ascii_art()
112
- print(ascii_art)
113
- print("=" * 60)
114
- print(f"Version: {PROJECT_VERSION}")
115
- print(f"Description: {PROJECT_DESCRIPTION}")
116
- print("=" * 60)
119
+ console.print(f"[bold cyan]{ascii_art}[/bold cyan]")
120
+
121
+ info_panel = Panel(
122
+ f"[bold]Version:[/bold] [cyan]{PROJECT_VERSION}[/cyan]\n"
123
+ f"[bold]Description:[/bold] [cyan]{PROJECT_DESCRIPTION}[/cyan]",
124
+ border_style="cyan",
125
+ title="[bold green]System Info[/bold green]",
126
+ padding=(1, 2)
127
+ )
128
+ console.print(info_panel)
117
129
 
118
130
 
119
131
  def parse_markdown(content: str) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: docpilot-cli
3
- Version: 1.0.1
3
+ Version: 1.0.3
4
4
  Summary: A local-first RAG pipeline CLI tool
5
5
  Requires-Python: >=3.12
6
6
  Description-Content-Type: text/markdown
@@ -59,9 +59,11 @@ pip install "docpilot-cli[pdf]"
59
59
  ```
60
60
 
61
61
  ### Prerequisites
62
+
62
63
  1. **Python 3.12+**
63
64
  2. **[Ollama](https://ollama.com/)**: Installed and running in the background.
64
65
  3. Pull your preferred models:
66
+
65
67
  ```bash
66
68
  ollama pull qwen2.5:latest
67
69
  ollama pull mxbai-embed-large:335m
@@ -71,9 +73,10 @@ ollama pull mxbai-embed-large:335m
71
73
 
72
74
  ## 🛠️ Quick Start
73
75
 
74
- The very first time you run a DocPilot command, it will launch the **Interactive Setup Wizard** to help you configure your chat and embedding models.
76
+ The very first time you run a DocPilot command, it will launch the **Interactive Setup Wizard** to help you configure your chat and embedding models.
75
77
 
76
78
  ### 1. Ingest Knowledge
79
+
77
80
  Point DocPilot to any documentation site, sitemap, PDF, or CSV:
78
81
 
79
82
  ```bash
@@ -87,7 +90,11 @@ docpilot ingest "./docs/engineering_handbook.pdf"
87
90
  docpilot ingest "./data/faq.csv"
88
91
  ```
89
92
 
93
+ > [!TIP]
94
+ > If you installed via standard `pip` and get a "command not found" error because your binary path isn't configured, you can always run docpilot by prefixing commands with `python -m docpilot` (e.g., `python -m docpilot ingest ...`).
95
+
90
96
  ### 2. Ask Questions
97
+
91
98
  Query your newly created local knowledge base:
92
99
 
93
100
  ```bash
@@ -101,26 +108,34 @@ docpilot ask "How do I create a virtual environment?"
101
108
  Manage your configuration, models, and local database with ease.
102
109
 
103
110
  ### `docpilot setup`
111
+
104
112
  Re-run the interactive setup wizard at any time to change your default models.
105
113
 
106
114
  ### `docpilot project`
115
+
107
116
  Switch to a different project or check the active project. Each project has its own isolated vector database.
117
+
108
118
  ```bash
109
119
  docpilot project
110
120
  docpilot project <project-name>
111
121
  ```
112
122
 
113
123
  ### `docpilot clear`
124
+
114
125
  Wipe your local Chroma vector database to start fresh. Prompts for safety confirmation.
115
126
 
116
127
  ### `docpilot speed [profile]`
128
+
117
129
  Adjust the retrieval and generation settings for your desired use case.
130
+
118
131
  - `fast`: Lower latency, shorter context limits.
119
132
  - `balanced`: Default trade-off.
120
133
  - `quality`: Larger context, more comprehensive answers, slower inference.
121
134
 
122
135
  ### `docpilot model`
136
+
123
137
  Manually manage your Ollama models without the interactive setup wizard.
138
+
124
139
  ```bash
125
140
  docpilot model list
126
141
  docpilot model set <chat-model>
@@ -128,9 +143,11 @@ docpilot model setembed <embedding-model>
128
143
  ```
129
144
 
130
145
  ### `docpilot render`
146
+
131
147
  Parse and beautifully render any markdown file or text string directly in your terminal.
132
148
 
133
149
  ### `docpilot show`
150
+
134
151
  Display your current project version and configuration in beautiful ASCII art.
135
152
 
136
153
  ---
@@ -153,6 +170,7 @@ DocPilot employs an optimized RAG (Retrieval-Augmented Generation) pipeline:
153
170
  Contributions are welcome! If you are using DocPilot for your daily workflows or in a hackathon, feel free to open issues and pull requests.
154
171
 
155
172
  To set up a local development environment:
173
+
156
174
  ```bash
157
175
  git clone https://github.com/yourusername/docpilot.git
158
176
  cd docpilot
@@ -2,6 +2,7 @@ LICENSE
2
2
  README.md
3
3
  pyproject.toml
4
4
  src/docpilot/__init__.py
5
+ src/docpilot/__main__.py
5
6
  src/docpilot/chat.py
6
7
  src/docpilot/cli.py
7
8
  src/docpilot/embed.py
File without changes
File without changes