docpilot-cli 1.0.2__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.2 → docpilot_cli-1.0.3}/PKG-INFO +17 -2
  2. {docpilot_cli-1.0.2 → docpilot_cli-1.0.3}/README.md +17 -2
  3. {docpilot_cli-1.0.2 → docpilot_cli-1.0.3}/pyproject.toml +1 -1
  4. {docpilot_cli-1.0.2 → docpilot_cli-1.0.3}/src/docpilot/chat.py +16 -3
  5. {docpilot_cli-1.0.2 → docpilot_cli-1.0.3}/src/docpilot/cli.py +27 -15
  6. {docpilot_cli-1.0.2 → docpilot_cli-1.0.3}/src/docpilot_cli.egg-info/PKG-INFO +17 -2
  7. {docpilot_cli-1.0.2 → docpilot_cli-1.0.3}/LICENSE +0 -0
  8. {docpilot_cli-1.0.2 → docpilot_cli-1.0.3}/setup.cfg +0 -0
  9. {docpilot_cli-1.0.2 → docpilot_cli-1.0.3}/src/docpilot/__init__.py +0 -0
  10. {docpilot_cli-1.0.2 → docpilot_cli-1.0.3}/src/docpilot/__main__.py +0 -0
  11. {docpilot_cli-1.0.2 → docpilot_cli-1.0.3}/src/docpilot/embed.py +0 -0
  12. {docpilot_cli-1.0.2 → docpilot_cli-1.0.3}/src/docpilot/scrape.py +0 -0
  13. {docpilot_cli-1.0.2 → docpilot_cli-1.0.3}/src/docpilot/store.py +0 -0
  14. {docpilot_cli-1.0.2 → docpilot_cli-1.0.3}/src/docpilot_cli.egg-info/SOURCES.txt +0 -0
  15. {docpilot_cli-1.0.2 → docpilot_cli-1.0.3}/src/docpilot_cli.egg-info/dependency_links.txt +0 -0
  16. {docpilot_cli-1.0.2 → docpilot_cli-1.0.3}/src/docpilot_cli.egg-info/entry_points.txt +0 -0
  17. {docpilot_cli-1.0.2 → docpilot_cli-1.0.3}/src/docpilot_cli.egg-info/requires.txt +0 -0
  18. {docpilot_cli-1.0.2 → docpilot_cli-1.0.3}/src/docpilot_cli.egg-info/top_level.txt +0 -0
  19. {docpilot_cli-1.0.2 → docpilot_cli-1.0.3}/tests/test_cli.py +0 -0
  20. {docpilot_cli-1.0.2 → 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.2
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
@@ -91,6 +94,7 @@ docpilot ingest "./data/faq.csv"
91
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 ...`).
92
95
 
93
96
  ### 2. Ask Questions
97
+
94
98
  Query your newly created local knowledge base:
95
99
 
96
100
  ```bash
@@ -104,26 +108,34 @@ docpilot ask "How do I create a virtual environment?"
104
108
  Manage your configuration, models, and local database with ease.
105
109
 
106
110
  ### `docpilot setup`
111
+
107
112
  Re-run the interactive setup wizard at any time to change your default models.
108
113
 
109
114
  ### `docpilot project`
115
+
110
116
  Switch to a different project or check the active project. Each project has its own isolated vector database.
117
+
111
118
  ```bash
112
119
  docpilot project
113
120
  docpilot project <project-name>
114
121
  ```
115
122
 
116
123
  ### `docpilot clear`
124
+
117
125
  Wipe your local Chroma vector database to start fresh. Prompts for safety confirmation.
118
126
 
119
127
  ### `docpilot speed [profile]`
128
+
120
129
  Adjust the retrieval and generation settings for your desired use case.
130
+
121
131
  - `fast`: Lower latency, shorter context limits.
122
132
  - `balanced`: Default trade-off.
123
133
  - `quality`: Larger context, more comprehensive answers, slower inference.
124
134
 
125
135
  ### `docpilot model`
136
+
126
137
  Manually manage your Ollama models without the interactive setup wizard.
138
+
127
139
  ```bash
128
140
  docpilot model list
129
141
  docpilot model set <chat-model>
@@ -131,9 +143,11 @@ docpilot model setembed <embedding-model>
131
143
  ```
132
144
 
133
145
  ### `docpilot render`
146
+
134
147
  Parse and beautifully render any markdown file or text string directly in your terminal.
135
148
 
136
149
  ### `docpilot show`
150
+
137
151
  Display your current project version and configuration in beautiful ASCII art.
138
152
 
139
153
  ---
@@ -156,6 +170,7 @@ DocPilot employs an optimized RAG (Retrieval-Augmented Generation) pipeline:
156
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.
157
171
 
158
172
  To set up a local development environment:
173
+
159
174
  ```bash
160
175
  git clone https://github.com/yourusername/docpilot.git
161
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
@@ -69,6 +72,7 @@ docpilot ingest "./data/faq.csv"
69
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 ...`).
70
73
 
71
74
  ### 2. Ask Questions
75
+
72
76
  Query your newly created local knowledge base:
73
77
 
74
78
  ```bash
@@ -82,26 +86,34 @@ docpilot ask "How do I create a virtual environment?"
82
86
  Manage your configuration, models, and local database with ease.
83
87
 
84
88
  ### `docpilot setup`
89
+
85
90
  Re-run the interactive setup wizard at any time to change your default models.
86
91
 
87
92
  ### `docpilot project`
93
+
88
94
  Switch to a different project or check the active project. Each project has its own isolated vector database.
95
+
89
96
  ```bash
90
97
  docpilot project
91
98
  docpilot project <project-name>
92
99
  ```
93
100
 
94
101
  ### `docpilot clear`
102
+
95
103
  Wipe your local Chroma vector database to start fresh. Prompts for safety confirmation.
96
104
 
97
105
  ### `docpilot speed [profile]`
106
+
98
107
  Adjust the retrieval and generation settings for your desired use case.
108
+
99
109
  - `fast`: Lower latency, shorter context limits.
100
110
  - `balanced`: Default trade-off.
101
111
  - `quality`: Larger context, more comprehensive answers, slower inference.
102
112
 
103
113
  ### `docpilot model`
114
+
104
115
  Manually manage your Ollama models without the interactive setup wizard.
116
+
105
117
  ```bash
106
118
  docpilot model list
107
119
  docpilot model set <chat-model>
@@ -109,9 +121,11 @@ docpilot model setembed <embedding-model>
109
121
  ```
110
122
 
111
123
  ### `docpilot render`
124
+
112
125
  Parse and beautifully render any markdown file or text string directly in your terminal.
113
126
 
114
127
  ### `docpilot show`
128
+
115
129
  Display your current project version and configuration in beautiful ASCII art.
116
130
 
117
131
  ---
@@ -134,6 +148,7 @@ DocPilot employs an optimized RAG (Retrieval-Augmented Generation) pipeline:
134
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.
135
149
 
136
150
  To set up a local development environment:
151
+
137
152
  ```bash
138
153
  git clone https://github.com/yourusername/docpilot.git
139
154
  cd docpilot
@@ -145,4 +160,4 @@ uv run pytest
145
160
 
146
161
  ## 📄 License
147
162
 
148
- 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.2"
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"
@@ -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.2"
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.2
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
@@ -91,6 +94,7 @@ docpilot ingest "./data/faq.csv"
91
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 ...`).
92
95
 
93
96
  ### 2. Ask Questions
97
+
94
98
  Query your newly created local knowledge base:
95
99
 
96
100
  ```bash
@@ -104,26 +108,34 @@ docpilot ask "How do I create a virtual environment?"
104
108
  Manage your configuration, models, and local database with ease.
105
109
 
106
110
  ### `docpilot setup`
111
+
107
112
  Re-run the interactive setup wizard at any time to change your default models.
108
113
 
109
114
  ### `docpilot project`
115
+
110
116
  Switch to a different project or check the active project. Each project has its own isolated vector database.
117
+
111
118
  ```bash
112
119
  docpilot project
113
120
  docpilot project <project-name>
114
121
  ```
115
122
 
116
123
  ### `docpilot clear`
124
+
117
125
  Wipe your local Chroma vector database to start fresh. Prompts for safety confirmation.
118
126
 
119
127
  ### `docpilot speed [profile]`
128
+
120
129
  Adjust the retrieval and generation settings for your desired use case.
130
+
121
131
  - `fast`: Lower latency, shorter context limits.
122
132
  - `balanced`: Default trade-off.
123
133
  - `quality`: Larger context, more comprehensive answers, slower inference.
124
134
 
125
135
  ### `docpilot model`
136
+
126
137
  Manually manage your Ollama models without the interactive setup wizard.
138
+
127
139
  ```bash
128
140
  docpilot model list
129
141
  docpilot model set <chat-model>
@@ -131,9 +143,11 @@ docpilot model setembed <embedding-model>
131
143
  ```
132
144
 
133
145
  ### `docpilot render`
146
+
134
147
  Parse and beautifully render any markdown file or text string directly in your terminal.
135
148
 
136
149
  ### `docpilot show`
150
+
137
151
  Display your current project version and configuration in beautiful ASCII art.
138
152
 
139
153
  ---
@@ -156,6 +170,7 @@ DocPilot employs an optimized RAG (Retrieval-Augmented Generation) pipeline:
156
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.
157
171
 
158
172
  To set up a local development environment:
173
+
159
174
  ```bash
160
175
  git clone https://github.com/yourusername/docpilot.git
161
176
  cd docpilot
File without changes
File without changes