Name | searchmind JSON |
Version |
0.1.4
JSON |
| download |
home_page | None |
Summary | A simple Python client for the Snapzion Search API, packaged as SearchMind. |
upload_time | 2025-08-10 18:45:42 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | None |
keywords |
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# SearchMind: A Python Client for Snapzion Search
 
A simple Python client for the [Snapzion Search API](https://search.snapzion.com/docs).
**SearchMind** is a lightweight wrapper that makes it easy to fetch search results and format them for use in other applications, especially for providing real-time web context to Large Language Models (LLMs) like those from OpenAI.
## Features
- Simple and intuitive API: `client.search("your query")`.
- Built-in helper to format results into a clean string for LLM prompts.
- Uses `requests.Session` for efficient connection pooling.
- Proper error handling with custom `SearchMindError` exceptions.
- Fully type-hinted for better editor support and code quality.
## Installation
```bash
pip install searchmind
```
## Quick Start
Getting search results is straightforward.
```python
from searchmind import SearchMindClient, SearchMindError
# 1. Initialize the client
client = SearchMindClient()
# 2. Perform a search
try:
results = client.search("latest trends in renewable energy")
# The result is a list of dictionaries
for item in results:
print(f"[{item['position']}] {item['title']}")
print(f" Link: {item['link']}\n")
except SearchMindError as e:
print(f"An error occurred: {e}")
```
## Usage with LLMs (e.g., OpenAI API)
The primary goal of this library is to act as a web search tool for LLMs. The `format_for_llm` utility creates a perfectly formatted context string.
```python
from searchmind import SearchMindClient, format_for_llm, APIError
# from openai import OpenAI # Hypothetical usage
# 1. Initialize the SearchMind client
search_client = SearchMindClient()
# 2. Define your query
user_query = "What are the main AI trends for 2025 according to recent articles?"
# 3. Get search results
try:
print(f"Searching for: '{user_query}'...")
search_results = search_client.search(user_query)
# 4. Format the results into a single string for the LLM
search_context = format_for_llm(search_results)
print("\n--- Formatted Context for LLM ---\n")
print(search_context)
# 5. Use the context in a prompt to an LLM
# client = OpenAI(api_key="your-openai-key")
#
# response = client.chat.completions.create(
# model="gpt-4o",
# messages=[
# {"role": "system", "content": "You are a helpful assistant. Answer the user's question based *only* on the provided search context. Cite your sources using the [number] and URL."},
# {"role": "user", "content": f"Question: {user_query}\n\nSearch Context:\n---\n{search_context}\n---"}
# ]
# )
#
# print("\n--- LLM Response ---\n")
# print(response.choices[0].message.content)
except APIError as e:
print(f"An error occurred while searching: {e}")
```
## Contributing
Contributions are welcome! Please open an issue or submit a pull request on our [GitHub repository](https://github.com/Niansuh/SearchMind).
## License
This project is licensed under the MIT License.
Raw data
{
"_id": null,
"home_page": null,
"name": "searchmind",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "Niansuh <contact@typegpt.net>",
"download_url": "https://files.pythonhosted.org/packages/09/d8/e2db65ec8dd0d50b07d531ee26cef24aafa573bf6a638f2bcb382850f3fe/searchmind-0.1.4.tar.gz",
"platform": null,
"description": "# SearchMind: A Python Client for Snapzion Search\n\n \n\nA simple Python client for the [Snapzion Search API](https://search.snapzion.com/docs).\n\n**SearchMind** is a lightweight wrapper that makes it easy to fetch search results and format them for use in other applications, especially for providing real-time web context to Large Language Models (LLMs) like those from OpenAI.\n\n## Features\n\n- Simple and intuitive API: `client.search(\"your query\")`.\n- Built-in helper to format results into a clean string for LLM prompts.\n- Uses `requests.Session` for efficient connection pooling.\n- Proper error handling with custom `SearchMindError` exceptions.\n- Fully type-hinted for better editor support and code quality.\n\n## Installation\n\n```bash\npip install searchmind\n```\n\n## Quick Start\n\nGetting search results is straightforward.\n\n```python\nfrom searchmind import SearchMindClient, SearchMindError\n\n# 1. Initialize the client\nclient = SearchMindClient()\n\n# 2. Perform a search\ntry:\n results = client.search(\"latest trends in renewable energy\")\n \n # The result is a list of dictionaries\n for item in results:\n print(f\"[{item['position']}] {item['title']}\")\n print(f\" Link: {item['link']}\\n\")\n\nexcept SearchMindError as e:\n print(f\"An error occurred: {e}\")\n```\n\n## Usage with LLMs (e.g., OpenAI API)\n\nThe primary goal of this library is to act as a web search tool for LLMs. The `format_for_llm` utility creates a perfectly formatted context string.\n\n```python\nfrom searchmind import SearchMindClient, format_for_llm, APIError\n# from openai import OpenAI # Hypothetical usage\n\n# 1. Initialize the SearchMind client\nsearch_client = SearchMindClient()\n\n# 2. Define your query\nuser_query = \"What are the main AI trends for 2025 according to recent articles?\"\n\n# 3. Get search results\ntry:\n print(f\"Searching for: '{user_query}'...\")\n search_results = search_client.search(user_query)\n\n # 4. Format the results into a single string for the LLM\n search_context = format_for_llm(search_results)\n\n print(\"\\n--- Formatted Context for LLM ---\\n\")\n print(search_context)\n \n # 5. Use the context in a prompt to an LLM\n # client = OpenAI(api_key=\"your-openai-key\")\n #\n # response = client.chat.completions.create(\n # model=\"gpt-4o\",\n # messages=[\n # {\"role\": \"system\", \"content\": \"You are a helpful assistant. Answer the user's question based *only* on the provided search context. Cite your sources using the [number] and URL.\"},\n # {\"role\": \"user\", \"content\": f\"Question: {user_query}\\n\\nSearch Context:\\n---\\n{search_context}\\n---\"}\n # ]\n # )\n #\n # print(\"\\n--- LLM Response ---\\n\")\n # print(response.choices[0].message.content)\n\nexcept APIError as e:\n print(f\"An error occurred while searching: {e}\")\n```\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request on our [GitHub repository](https://github.com/Niansuh/SearchMind).\n\n## License\n\nThis project is licensed under the MIT License.",
"bugtrack_url": null,
"license": null,
"summary": "A simple Python client for the Snapzion Search API, packaged as SearchMind.",
"version": "0.1.4",
"project_urls": {
"Bug Tracker": "https://github.com/Niansuh/SearchMind/issues",
"Homepage": "https://github.com/Niansuh/SearchMind"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "c2133f73699ed097f32f329bbb0cf6c382227ef295e65ef7ba8fd1459a8132bd",
"md5": "a87f326a1b14d1f05767e379dd6c3a38",
"sha256": "341aa34770bf739b1078d6a243fa3ce6d073ff778e3216254f482caf4a1d17b6"
},
"downloads": -1,
"filename": "searchmind-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a87f326a1b14d1f05767e379dd6c3a38",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 4814,
"upload_time": "2025-08-10T18:45:40",
"upload_time_iso_8601": "2025-08-10T18:45:40.913352Z",
"url": "https://files.pythonhosted.org/packages/c2/13/3f73699ed097f32f329bbb0cf6c382227ef295e65ef7ba8fd1459a8132bd/searchmind-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "09d8e2db65ec8dd0d50b07d531ee26cef24aafa573bf6a638f2bcb382850f3fe",
"md5": "2bfeb7fcf7253b685ad4144ae8aef0d7",
"sha256": "ecc009507cb8fcb0acf13b62eb4c6c01495eacb13b8196a24d42b3aac5c52292"
},
"downloads": -1,
"filename": "searchmind-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "2bfeb7fcf7253b685ad4144ae8aef0d7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 3784,
"upload_time": "2025-08-10T18:45:42",
"upload_time_iso_8601": "2025-08-10T18:45:42.050664Z",
"url": "https://files.pythonhosted.org/packages/09/d8/e2db65ec8dd0d50b07d531ee26cef24aafa573bf6a638f2bcb382850f3fe/searchmind-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-10 18:45:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Niansuh",
"github_project": "SearchMind",
"github_not_found": true,
"lcname": "searchmind"
}