Python package for semantic relevant web search results.
Project description
AgentWebSearch Package
Description
...
Quickstart
Create a AgentWebSearch Object
from agentwebsearch import AgentWebSearch
from agentwebsearch.websearch.request import WebSearchRequest
from agentwebsearch.search.client import DefaultSearchClient
from agentwebsearch.webscraper import DefaultWebScraper
from agentwebsearch.indexsearch import HNSWInMemoryIndexDB
from agentwebsearch.llm import OpenAIChatModel
from agentwebsearch.embedding import OpenAIEmbeddingModel
embedding_model = OpenAIEmbeddingModel(
model="text-embedding-3-large",
api_key="YOUR_OPENAI_API_KEY"
)
llm = OpenAIChatModel(
model="gpt-4o",
api_key="YOUR_OPENAI_API_KEY",
temperature=0.7
)
index_db = HNSWInMemoryIndexDB(embedding_model=embedding_model)
search_client = DefaultSearchClient()
scraper = DefaultWebScraper()
websearch = AgentWebSearch(
search_client=search_client,
index_db=index_db,
scraper=scraper,
llm=llm,
embedding_model=embedding_model
)
Execute AgentWebSearch
from agentwebsearch.websearch.request import RequestQuery, RequestQueryMessage
req = WebSearchRequest(
query=RequestQuery(
messages=[
RequestQueryMessage(
role="user",
content="Wann wurde der Bundeskanzler 2025 gewählt?"
)
]
)
)
result = websearch.execute(req)
# or
for result in websearch.execute(req, stream=True):
print(result)
yield result
Deploy as MCP-Server
# server.py
from agentwebsearch.mcp import WebSearchFastMCP
mcp = WebSearchFastMCP("Demo 🚀")
@mcp.tool
def other_tool():
return "Other tool"
if __name__ == "__main__":
# available tools:
# - websearch
# - other_tool
mcp.run(
transport="streamable-http",
host="127.0.0.1",
port=8000,
path="/mcp"
)
# python run server.py
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentwebsearch_py-0.2.0.tar.gz.
File metadata
- Download URL: agentwebsearch_py-0.2.0.tar.gz
- Upload date:
- Size: 112.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4741c5c553e56659582d804331656f08e27b7b878a92c8ca6e063c839c671d35
|
|
| MD5 |
c85477533a811b73d20ea80dbcac57d0
|
|
| BLAKE2b-256 |
85bfbe0ce3d87554ed6b8e64e4270f9c70f711b928171001d31c45f7b5e6f1c6
|
Provenance
The following attestation bundles were made for agentwebsearch_py-0.2.0.tar.gz:
Publisher:
release.yml on enricogoerlitz/agentwebsearch-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentwebsearch_py-0.2.0.tar.gz -
Subject digest:
4741c5c553e56659582d804331656f08e27b7b878a92c8ca6e063c839c671d35 - Sigstore transparency entry: 312889534
- Sigstore integration time:
-
Permalink:
enricogoerlitz/agentwebsearch-py@2952b0d3dd0647926abff7ccdc7c9028c699bbd6 -
Branch / Tag:
refs/tags/0.2.0 - Owner: https://github.com/enricogoerlitz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2952b0d3dd0647926abff7ccdc7c9028c699bbd6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file agentwebsearch_py-0.2.0-py3-none-any.whl.
File metadata
- Download URL: agentwebsearch_py-0.2.0-py3-none-any.whl
- Upload date:
- Size: 23.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
037a5e1512a7d62560cddbdf4c98ad3422aba291a93ce31cb8e43eae36e5c531
|
|
| MD5 |
c081fd078d1b3764ec55bf531ac59385
|
|
| BLAKE2b-256 |
a8b7c49b6333a190e1e51d262a96d4daf4e78c31059f581bf3928c1625268dd3
|
Provenance
The following attestation bundles were made for agentwebsearch_py-0.2.0-py3-none-any.whl:
Publisher:
release.yml on enricogoerlitz/agentwebsearch-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentwebsearch_py-0.2.0-py3-none-any.whl -
Subject digest:
037a5e1512a7d62560cddbdf4c98ad3422aba291a93ce31cb8e43eae36e5c531 - Sigstore transparency entry: 312889553
- Sigstore integration time:
-
Permalink:
enricogoerlitz/agentwebsearch-py@2952b0d3dd0647926abff7ccdc7c9028c699bbd6 -
Branch / Tag:
refs/tags/0.2.0 - Owner: https://github.com/enricogoerlitz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2952b0d3dd0647926abff7ccdc7c9028c699bbd6 -
Trigger Event:
push
-
Statement type: