Observed since 20 Oct, 22:21 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
code for an agentic search tool using Langchain
Multimedia search capabilities for your projects, fully local.
This repo holds the code for an agentic search tool package, building up on this excellent LangChain web search assistant YouTube tutorial. I want to automate my searches on various data sources, as well as their analysis.
It can search:
The idea here is to modularize all that logic so that it can be reused in other projects.
This has been tested on a Ubuntu 24 server. You'll need:
.env.example file
WITH_DEBUG_MESSAGES is set to true (as in the .env.example file), the output to stdout will be more verboseyollama packagepgvector extension installed, as the PostgreSQL generation code assumes you're using vectors in the prompts)venv and pip installedpip install agentic-search
Let's say you want to test the generate_sql_query chain with pytest in your project.
from agentic_search.capabilities.web import get_web_search_results
res = await get_web_search_results("what is the ticker symbol of the biggest yoghurt company in the world") # string output
.env file)data as key and the webpage text (without the HTML markup) as valueSCRAPING_SERVICE_AUTH_HEADER_NAME=auth-header-name
SCRAPING_SERVICE_AUTH_HEADER_VALUE=auth-header-value
SCRAPING_SERVICE_URL=https://my-scraping-service.com
USE_EXTERNAL_SCRAPING_SERVICE=0
... the scraping service should have two endpoints:
POST /scrape-multiple to scrape multiple URLs at oncePOST /scrape to scrape a single URL... and the JSON response should have a data key with the webpage text as value, you can see an example of how it is used in agentic_search/functions/web.py ->
async def get_webpage_text_using_scraping_service(webpage_url: str) -> str:
headers = {
os.getenv("SCRAPING_SERVICE_AUTH_HEADER_NAME"): os.getenv(
"SCRAPING_SERVICE_AUTH_HEADER_VALUE"
)
}
async with aiohttp.ClientSession() as session:
async with session.post(
f"{os.getenv('SCRAPING_SERVICE_URL')}/scrape-single",
json={"url": webpage_url},
headers=headers,
) as response:
response_data = await response.json()
return response_data["data"]
agentic_search/capabilities/web.py -> get_web_search_resultsopenai | ollama for the WEBSEARCH_LLM_PROVIDER env varmetadata key will hold the video titleagentic_search/
capabilities/
chains/
functions/
graphs/
nodes/
prompts/
We support capabilities for:
We support chains for:
We support graphs for:
Functions are simple Python functions that can be used by other components of the system. They are located in the functions/ folder.
Prompts are the LLM prompts used by the chains. They are located in the prompts/ folder.
Chains in this project are the basic building blocks that perform specific operations. They are located in the chains/ folder and typically:
.invoke() methodThe chains can be orchestrated using graphs (located in the graphs/ folder), which provides:
The graphs themselves use nodes, which are steps during the graph execution that can be composed together at will, located in the nodes/ folder.
Nodes can be plain agent nodes, with custom logic, or tools or set of tools (kinda like a toolbelt) that can be used by the agent.
Capabilities (located in the capabilities/ folder), on the other hand, are higher-level features that:
.invoke() calls from the end user, unlike chains and graphsAbstraction Level:
Usage Pattern:
Composition:
Output:
This architecture allows for better modularity and reusability, as chains and graphs can be mixed and matched to create different capabilities while keeping the core logic separate from the high-level features. The graphs layer ensures reliable execution and state management throughout the workflow. The capabilities layer, on the other hand, provide a user-friendly interface for interacting with the system.
To run the tests, follow these steps:
Navigate to the project root directory.
Run all tests:
pytest
To run tests from a specific file:
pytest agentic_search/functions/test_text.py -vv -s
To run a specific test function:
pytest -k "test_normalize_and_lemmatize_text" agentic_search/functions/test_text.py -vv -s
I've decided to let go of OpenAI to:
As local models are getting better and better, I'm confident that I'll be able to have a greater experience in the future, even with my small 20GB VRAM GPU. 🤔 Of course, it's not fast, but hey everything comes with tradeoffs right? 💪
In conclusion, all components of this package should be runnable by local models with a customer-grade GPU configuration.
The Arxiv and web search features are heavily inspired by https://github.com/assafelovic/gpt-researcher, which basically splits up one search into multiple sub searches before generating a final output.
For instance, you would have:
🤝 I haven't made up my mind on contribution guidelines yet. I guess we'll update them as you contribute!
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 12.0.1 | 2 Mar 2025 | 19 |
This describes our collected data; it is not a security assessment.
Shared repository data · GitHub
Observed since 20 Oct, 22:21 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:12d782a40f6c54da704a62c99d46362389b23a3adf30c4062f37f727136a9bab