opencode-skills-collection 3.1.9 → 3.1.11

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 (66) hide show
  1. package/bundled-skills/.antigravity-install-manifest.json +8 -1
  2. package/bundled-skills/browser-testing-with-devtools/SKILL.md +334 -0
  3. package/bundled-skills/docs/integrations/jetski-cortex.md +3 -3
  4. package/bundled-skills/docs/integrations/jetski-gemini-loader/README.md +1 -1
  5. package/bundled-skills/docs/maintainers/repo-growth-seo.md +3 -3
  6. package/bundled-skills/docs/maintainers/skills-update-guide.md +1 -1
  7. package/bundled-skills/docs/sources/sources.md +4 -0
  8. package/bundled-skills/docs/users/bundles.md +1 -1
  9. package/bundled-skills/docs/users/claude-code-skills.md +1 -1
  10. package/bundled-skills/docs/users/gemini-cli-skills.md +1 -1
  11. package/bundled-skills/docs/users/getting-started.md +1 -1
  12. package/bundled-skills/docs/users/kiro-integration.md +1 -1
  13. package/bundled-skills/docs/users/usage.md +4 -4
  14. package/bundled-skills/docs/users/visual-guide.md +4 -4
  15. package/bundled-skills/drizzle-migration-conflict/SKILL.md +179 -0
  16. package/bundled-skills/drizzle-migration-conflict/references/ci-policy.md +87 -0
  17. package/bundled-skills/drizzle-migration-conflict/references/conflict-resolution.md +163 -0
  18. package/bundled-skills/drizzle-migration-conflict/references/report-template.md +69 -0
  19. package/bundled-skills/drizzle-migration-conflict/references/sources.md +51 -0
  20. package/bundled-skills/drizzle-migration-conflict/scripts/check_drizzle_migrations.py +721 -0
  21. package/bundled-skills/frontend-lighthouse/SKILL.md +348 -0
  22. package/bundled-skills/pre-release-review/SKILL.md +198 -0
  23. package/bundled-skills/pre-release-review/references/checklist.md +104 -0
  24. package/bundled-skills/pre-release-review/references/report-template.md +91 -0
  25. package/bundled-skills/re-create/SKILL.md +251 -0
  26. package/bundled-skills/weaviate/SKILL.md +132 -0
  27. package/bundled-skills/weaviate/references/ask.md +36 -0
  28. package/bundled-skills/weaviate/references/create_collection.md +152 -0
  29. package/bundled-skills/weaviate/references/environment_requirements.md +34 -0
  30. package/bundled-skills/weaviate/references/example_data.md +24 -0
  31. package/bundled-skills/weaviate/references/explore_collection.md +50 -0
  32. package/bundled-skills/weaviate/references/fetch_filter.md +88 -0
  33. package/bundled-skills/weaviate/references/get_collection.md +32 -0
  34. package/bundled-skills/weaviate/references/hybrid_search.md +47 -0
  35. package/bundled-skills/weaviate/references/import_data.md +160 -0
  36. package/bundled-skills/weaviate/references/keyword_search.md +38 -0
  37. package/bundled-skills/weaviate/references/list_collections.md +31 -0
  38. package/bundled-skills/weaviate/references/query_search.md +38 -0
  39. package/bundled-skills/weaviate/references/semantic_search.md +46 -0
  40. package/bundled-skills/weaviate/scripts/ask.py +106 -0
  41. package/bundled-skills/weaviate/scripts/create_collection.py +359 -0
  42. package/bundled-skills/weaviate/scripts/example_data.py +945 -0
  43. package/bundled-skills/weaviate/scripts/explore_collection.py +295 -0
  44. package/bundled-skills/weaviate/scripts/fetch_filter.py +261 -0
  45. package/bundled-skills/weaviate/scripts/get_collection.py +122 -0
  46. package/bundled-skills/weaviate/scripts/hybrid_search.py +157 -0
  47. package/bundled-skills/weaviate/scripts/import.py +701 -0
  48. package/bundled-skills/weaviate/scripts/keyword_search.py +142 -0
  49. package/bundled-skills/weaviate/scripts/list_collections.py +77 -0
  50. package/bundled-skills/weaviate/scripts/query_search.py +135 -0
  51. package/bundled-skills/weaviate/scripts/semantic_search.py +139 -0
  52. package/bundled-skills/weaviate/scripts/weaviate_conn.py +231 -0
  53. package/bundled-skills/weaviate-cookbooks/SKILL.md +67 -0
  54. package/bundled-skills/weaviate-cookbooks/references/advanced_rag.md +274 -0
  55. package/bundled-skills/weaviate-cookbooks/references/agentic_rag.md +360 -0
  56. package/bundled-skills/weaviate-cookbooks/references/async_client.md +428 -0
  57. package/bundled-skills/weaviate-cookbooks/references/basic_agent.md +270 -0
  58. package/bundled-skills/weaviate-cookbooks/references/basic_rag.md +219 -0
  59. package/bundled-skills/weaviate-cookbooks/references/data_explorer.md +336 -0
  60. package/bundled-skills/weaviate-cookbooks/references/environment_requirements.md +78 -0
  61. package/bundled-skills/weaviate-cookbooks/references/frontend_interface.md +104 -0
  62. package/bundled-skills/weaviate-cookbooks/references/pdf_multimodal_rag.md +635 -0
  63. package/bundled-skills/weaviate-cookbooks/references/project_setup.md +75 -0
  64. package/bundled-skills/weaviate-cookbooks/references/query_agent_chatbot.md +163 -0
  65. package/package.json +1 -1
  66. package/skills_index.json +156 -0
@@ -0,0 +1,360 @@
1
+ # Agentic RAG Cookbook
2
+
3
+ Build RAG-powered AI agents with Weaviate.
4
+
5
+ Read first:
6
+ - Basic Agent cookbook, important to start from this base. MUST READ: [Basic Agent Cookbook](./basic_agent.md)
7
+
8
+ Docs to reference if needed:
9
+ - Search patterns and basics in Weaviate: https://docs.weaviate.io/weaviate/search/basics
10
+ - Filters in Weaviate: https://docs.weaviate.io/weaviate/search/filters
11
+ - Hybrid search: https://docs.weaviate.io/weaviate/search/hybrid
12
+ - Weaviate Query Agent: https://docs.weaviate.io/agents/query/usage
13
+ - Elysia: https://weaviate.github.io/elysia/
14
+
15
+
16
+ ## Core Rules
17
+
18
+ First implement the basic agent from [here](./basic_agent.md). Then modify according to this guide.
19
+
20
+ - Use a virtual environment via `venv`
21
+ - Use `uv` for Python project/dependency management.
22
+ - Do not manually author `pyproject.toml` or `uv.lock`; let `uv` generate/update them.
23
+ - Use this install set: `uv add weaviate-client python-dotenv dspy`
24
+ - Add `weaviate-agents` if using the Query Agent: `uv add "weaviate-client[agents]"`
25
+ - Add `elysia-ai` if using Elysia: `uv add elysia-ai`
26
+ - Customise this cookbook to the users specification, ask them for details if not given.
27
+
28
+ Assume the user has data already to be used, do not create data unless asked to.
29
+
30
+ Instead of following this cookbook, you first must ask the user if they would prefer to use the Weaviate Query Agent or Elysia. If so, skip to the relevant section below.
31
+
32
+ - Query Agent docs: https://docs.weaviate.io/agents/query/usage
33
+ - Elysia docs: https://weaviate.github.io/elysia/
34
+
35
+ ## Env Rules
36
+
37
+ Mandatory:
38
+ - An LLM provider API key (e.g. `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GEMINI_API_KEY`)
39
+ - `WEAVIATE_URL`
40
+ - `WEAVIATE_API_KEY`
41
+
42
+ External provider keys:
43
+ - Fill only keys actually used by the target Weaviate collection setup.
44
+
45
+
46
+ ## Agentic RAG Overview
47
+
48
+ * Naive RAG tool: *Basic retrieval as a single tool for the RouterAgent*
49
+ * Hierarchical RAG: *LLM-created filters and search parameters as a sub-agent tool*
50
+ * Vector DB memory: *Store and retrieve facts across sessions using Weaviate*
51
+ * Query Agent: *Pre-built agentic RAG service by Weaviate*
52
+ * Elysia: *Open source agentic framework with built-in query tool*
53
+
54
+
55
+ ## Naive RAG Tool
56
+
57
+ A simple retrieval tool that the RouterAgent can call. Pass this as a tool to the RouterAgent from the [basic agent cookbook](./basic_agent.md).
58
+
59
+ ```python
60
+ from weaviate import connect_to_weaviate_cloud
61
+ import os
62
+
63
+ def retrieve_data(query: str):
64
+ """
65
+ Given a query (free text), return the most relevant documents from the vector database using hybrid search.
66
+ """
67
+ client = connect_to_weaviate_cloud(
68
+ cluster_url=os.getenv("WEAVIATE_URL", ""),
69
+ auth_credentials=os.getenv("WEAVIATE_API_KEY", ""),
70
+ )
71
+ collection = client.collections.use("<collection_name>")
72
+ response = collection.query.hybrid(query=query, limit=5)
73
+ client.close()
74
+ return f"{[obj.properties for obj in response.objects]}"
75
+ ```
76
+
77
+ Customise the search type (`hybrid`, `near_text`, `bm25`), `limit`, and return fields based on the use case.
78
+
79
+
80
+ ## Hierarchical RAG (LLM-created Filters)
81
+
82
+ Instead of simple retrieval, use an LLM sub-agent to construct filters and search parameters. This makes the tool itself an agent.
83
+
84
+ 1. Structured response models for filters:
85
+
86
+ ```python
87
+ from pydantic import BaseModel, Field
88
+ from typing import Literal, Any
89
+
90
+ class SearchFilter(BaseModel):
91
+ field: str = Field(description="The field to be filtered on.")
92
+ operator: Literal["=", "!=", ">", "<"] = Field(description="The operator to be used in conjunction with the value.")
93
+ value: Any = Field(description="The value to be used in conjunction with the operator.")
94
+
95
+ class Search(BaseModel):
96
+ query: str = Field(description="The search query to be used in the vector database.")
97
+ filters: list[SearchFilter] = Field(description="The filters to be used in the vector database.")
98
+ limit: int = Field(description="The number of results to return from the vector database.")
99
+
100
+ class SearchCreation(dspy.Signature):
101
+ """
102
+ Create a search query for a vector database.
103
+ """
104
+ user_prompt: str = dspy.InputField()
105
+ schema: list[dict] = dspy.InputField(desc="Schema of the collection to be searched.")
106
+ search: Search = dspy.OutputField(
107
+ desc=(
108
+ "Your search query and filters, this should be a valid JSON object. "
109
+ "This should be constructed so that it matches the goal of the user prompt."
110
+ )
111
+ )
112
+ ```
113
+
114
+ 2. Helper function to convert structured filters to Weaviate filters:
115
+
116
+ ```python
117
+ from weaviate.classes.query import Filter
118
+
119
+ def format_filters(search_filters: list[SearchFilter]):
120
+ filters = []
121
+ for search_filter in search_filters:
122
+ base_filter = Filter.by_property(search_filter.field)
123
+ if search_filter.operator == "=":
124
+ filters.append(base_filter.equal(search_filter.value))
125
+ elif search_filter.operator == "!=":
126
+ filters.append(base_filter.not_equal(search_filter.value))
127
+ elif search_filter.operator == ">":
128
+ filters.append(base_filter.greater_than(search_filter.value))
129
+ elif search_filter.operator == "<":
130
+ filters.append(base_filter.less_than(search_filter.value))
131
+ return Filter.all_of(filters) if filters else None
132
+ ```
133
+
134
+ 3. The hierarchical query tool (replaces the naive retrieval tool):
135
+
136
+ ```python
137
+ def query_agent_tool(collection_name: str, user_prompt: str):
138
+ """
139
+ Given a query (free text), return the most relevant documents from the vector database using hybrid search with LLM-generated filters.
140
+ """
141
+ client = connect_to_weaviate_cloud(
142
+ cluster_url=os.getenv("WEAVIATE_URL", ""),
143
+ auth_credentials=os.getenv("WEAVIATE_API_KEY", ""),
144
+ )
145
+ collection = client.collections.use(collection_name)
146
+ config = collection.config.get()
147
+ schema = [{"name": p.name, "type": p.data_type[:]} for p in config.properties]
148
+
149
+ query_model = dspy.ChainOfThought(SearchCreation)
150
+ query_output = query_model(
151
+ user_prompt=user_prompt,
152
+ schema=schema,
153
+ lm=dspy.LM("<subtask_model_name>")
154
+ )
155
+
156
+ response = collection.query.hybrid(
157
+ query=query_output.search.query,
158
+ filters=format_filters(query_output.search.filters),
159
+ limit=query_output.search.limit
160
+ )
161
+ client.close()
162
+ return f"{[obj.properties for obj in response.objects]}"
163
+ ```
164
+
165
+ Schema information is required for the LLM to construct filters. Fetch dynamically via `collection.config.get()` or provide manually if the schema is stable. Consider enriching the schema with sample data or enumerated values for better filter accuracy.
166
+
167
+
168
+ ## Vector Database Memory
169
+
170
+ Store and retrieve facts across sessions using Weaviate. Only add this if cross-session persistence is required.
171
+
172
+ 1. Memory creation signature:
173
+
174
+ ```python
175
+ class MemoryCreation(dspy.Signature):
176
+ user_prompt: str = dspy.InputField()
177
+ assistant_response: str = dspy.InputField()
178
+ memory: str = dspy.OutputField(
179
+ description="A single string representing the most pertinent fact from the user/agent interaction."
180
+ )
181
+ ```
182
+
183
+ 2. Add `memories` as an input to `AgentResponse`:
184
+
185
+ ```python
186
+ class AgentResponse(dspy.Signature):
187
+
188
+ # Input Fields
189
+ history: dspy.History = dspy.InputField()
190
+ user_prompt: str = dspy.InputField()
191
+ available_tools: str = dspy.InputField()
192
+ memories: list[str] = dspy.InputField(
193
+ desc="A list of memories from previous conversations, you can use these to inform your response."
194
+ )
195
+
196
+ # Output Fields
197
+ response: str = dspy.OutputField(
198
+ description="The response to the user's prompt whilst the tool is running. Update the user on the progress of their request (if a tool is picked), or the final response to the user (if no tool is picked)."
199
+ )
200
+ tool: str | None = dspy.OutputField(
201
+ description="The tool that needs to be used. Return None if no tool is needed."
202
+ )
203
+ tool_inputs: Dict[str, Any] | None = dspy.OutputField(
204
+ description=(
205
+ "The inputs for the tool. Return an empty dictionary (still include the field) if no inputs are needed. "
206
+ "The key is the name of the input, the value is the value of the input."
207
+ )
208
+ )
209
+ ```
210
+
211
+ 3. Add `create_memory` and `retrieve_memories` methods to `RouterAgent`:
212
+
213
+ ```python
214
+ from weaviate import connect_to_weaviate_cloud
215
+ from weaviate.classes.config import Configure
216
+
217
+ class RouterAgent:
218
+ def __init__(self, model: str, memory_model: str | None = None, tools: List[Callable] = []):
219
+ self.tools: list[Callable] = tools
220
+ self.model = dspy.LM(model)
221
+ self.memory_model = dspy.LM(memory_model) if memory_model else dspy.LM(model)
222
+ self.agent = dspy.ChainOfThought(AgentResponse)
223
+ self.memory_agent = dspy.Predict(MemoryCreation)
224
+ self.conversation_history = dspy.History(messages=[])
225
+ self.weaviate_client = connect_to_weaviate_cloud(
226
+ cluster_url=os.getenv("WEAVIATE_URL", ""),
227
+ auth_credentials=os.getenv("WEAVIATE_API_KEY", ""),
228
+ )
229
+
230
+ # ... existing methods from basic_agent.md (add_conversation_history, get_tools_and_descriptions) ...
231
+
232
+ def create_memory(self, user_prompt: str, assistant_response: str, tool_result: str):
233
+ if tool_result:
234
+ assistant_response += "\n" + tool_result
235
+
236
+ result = self.memory_agent(
237
+ history=self.conversation_history,
238
+ user_prompt=user_prompt,
239
+ assistant_response=assistant_response,
240
+ lm=self.memory_model,
241
+ )
242
+ if not self.weaviate_client.collections.exists("Agent_Memory"):
243
+ self.weaviate_client.collections.create(
244
+ "Agent_Memory",
245
+ vector_config=Configure.Vectors.text2vec_weaviate()
246
+ )
247
+
248
+ collection = self.weaviate_client.collections.use("Agent_Memory")
249
+ collection.data.insert({"user_prompt": user_prompt, "memory": result.memory})
250
+ return result.memory
251
+
252
+ def retrieve_memories(self, user_prompt: str):
253
+ if not self.weaviate_client.collections.exists("Agent_Memory"):
254
+ return []
255
+ collection = self.weaviate_client.collections.use("Agent_Memory")
256
+ query = collection.query.near_text(query=user_prompt, limit=5)
257
+ return [memory.properties["memory"] for memory in query.objects]
258
+ ```
259
+
260
+ Call `retrieve_memories` at the start of each interaction and pass results to the `memories` field of `AgentResponse`. Call `create_memory` after each interaction.
261
+
262
+ Consider using a cheaper model for memory creation (e.g. `memory_model="<cheap_model_name>"`).
263
+
264
+
265
+ ## Weaviate Query Agent
266
+
267
+ Skip the custom implementation and use the pre-built Weaviate Query Agent for agentic RAG. Handles collection selection, filter construction, and query optimisation automatically.
268
+
269
+ ```python
270
+ from weaviate.agents.query import QueryAgent
271
+
272
+ # import client here
273
+
274
+ qa = QueryAgent(
275
+ client=client, collections=["<collection_name>"]
276
+ )
277
+ response = qa.search("<user query here>") # retrieval only
278
+ response = qa.ask("<user query here>") # retrieval + text response via response.final_answer
279
+ ```
280
+
281
+ The Query Agent is free up to 1000 requests per month. Docs: https://docs.weaviate.io/agents/query/usage
282
+
283
+
284
+ ## Elysia
285
+
286
+ Elysia is an open source agentic framework with built-in query tools, decision trees, error handling, and automatic retry.
287
+
288
+ Setup:
289
+
290
+ ```python
291
+ import elysia
292
+ from elysia.tools.text import FakeTextResponse as TextResponseTool
293
+
294
+ elysia.configure(
295
+ base_model="<model_name>",
296
+ base_provider="<provider>", # e.g. "anthropic", "openai"
297
+ logging_level="ERROR"
298
+ )
299
+ ```
300
+
301
+ With custom tools:
302
+
303
+ ```python
304
+ tree = elysia.Tree("empty", use_elysia_collections=False)
305
+ tree.add_tool(TextResponseTool)
306
+
307
+ @elysia.tool
308
+ async def your_tool(param: str):
309
+ """Tool description."""
310
+ return {"result"}
311
+
312
+ tree.add_tool(your_tool)
313
+ response, _ = tree("user query here")
314
+ ```
315
+
316
+ With built-in Weaviate query tool (requires preprocessing):
317
+
318
+ ```python
319
+ from elysia import preprocess
320
+ preprocess("<collection_name>")
321
+
322
+ tree = elysia.Tree()
323
+ response, _ = tree(
324
+ "user query here",
325
+ collection_names=["<collection_name>"]
326
+ )
327
+ ```
328
+
329
+ Elysia includes built-in error handling, self-healing, and automatic retry. Also available as a standalone app with a frontend UI: https://github.com/weaviate/elysia
330
+
331
+
332
+ ## Customisation Points
333
+
334
+ **When to use which approach:**
335
+
336
+ | Use Case | Recommended Approach |
337
+ |----------|---------------------|
338
+ | Single collection, simple queries | Naive RAG tool |
339
+ | Need filters or operators | Hierarchical RAG or Query Agent |
340
+ | Multi-step tasks, multiple data sources | Sequential agent with agentic loop |
341
+ | Cross-session personalisation | Add Vector Database Memory layer |
342
+ | Production deployment with error handling | Use Elysia or Query Agent |
343
+
344
+ **Do not implement multi-agent architectures for simple retrieval tasks.**
345
+
346
+ **LLM framework**
347
+
348
+ This guide used DSPy. Follow the guidelines in [here](./basic_agent.md), but most likely you will need an LLM framework involving structured responses.
349
+
350
+
351
+ ## Troubleshooting
352
+
353
+ - Weaviate startup host errors: ensure `WEAVIATE_URL` is full `https://...` URL.
354
+ - DSPy signature warnings about missing fields: these can occur when using followup agents without all fields; ensure optional fields are handled.
355
+ - For any other issues, refer to the official library/package documentation and use web search extensively for troubleshooting.
356
+
357
+ ## Done Criteria
358
+
359
+ - Create test scripts to check each function works independently with test data. Tear down tests after completion, or create a proper test suite with pytest (requires install)
360
+ - User has completed specification of the app.