Skip to main content

Haystack integration for Scavio Web Search

Project description

scavio-haystack

PyPI - Version PyPI - Python Version

Scavio integration for Haystack by deepset.

Provides ScavioWebSearch, a web search component backed by the Scavio API. It returns results as Haystack Document objects (with title and URL metadata) plus the list of source links, and mirrors the existing TavilyWebSearch / ExaWebSearch components.

Scavio is a unified search API for AI agents. Get an API key at dashboard.scavio.dev.

Installation

pip install scavio-haystack

Usage

from haystack_integrations.components.websearch.scavio import ScavioWebSearch
from haystack.utils import Secret

web_search = ScavioWebSearch(
    api_key=Secret.from_env_var("SCAVIO_API_KEY"),  # defaults to SCAVIO_API_KEY
    top_k=5,
)

result = web_search.run(query="What is Haystack by deepset?")
documents = result["documents"]
links = result["links"]

In a pipeline

from haystack import Pipeline
from haystack.components.builders import PromptBuilder
from haystack.components.generators import OpenAIGenerator
from haystack_integrations.components.websearch.scavio import ScavioWebSearch

template = """
Given the following web search results, answer the question.

Results:
{% for doc in documents %}{{ doc.content }}
{% endfor %}

Question: {{ query }}
Answer:
"""

pipe = Pipeline()
pipe.add_component("search", ScavioWebSearch(top_k=5))
pipe.add_component("prompt_builder", PromptBuilder(template=template))
pipe.add_component("llm", OpenAIGenerator())
pipe.connect("search.documents", "prompt_builder.documents")
pipe.connect("prompt_builder", "llm")

query = "What is Haystack by deepset?"
result = pipe.run(data={"search": {"query": query}, "prompt_builder": {"query": query}})
print(result["llm"]["replies"][0])

Async support

import asyncio
from haystack_integrations.components.websearch.scavio import ScavioWebSearch

async def main():
    web_search = ScavioWebSearch(top_k=3)
    result = await web_search.run_async(query="What is Haystack by deepset?")
    print(f"Found {len(result['documents'])} documents")

asyncio.run(main())

Parameters

  • api_key: API key for Scavio. Defaults to the SCAVIO_API_KEY environment variable.
  • top_k: Maximum number of results to return. Defaults to 10.
  • search_params: Additional parameters passed to the Scavio Google search endpoint. Supported keys include country_code, language, page, search_type, device, nfpr, light_request. Can be set at init time or overridden per run.

Development

This project uses Hatch.

pip install hatch

hatch run fmt-check     # lint + format check
hatch run test:unit     # unit tests
hatch run test:all      # all tests (set SCAVIO_API_KEY for integration tests)

License

scavio-haystack is distributed under the terms of the Apache-2.0 license.

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

scavio_haystack-0.1.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scavio_haystack-0.1.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file scavio_haystack-0.1.0.tar.gz.

File metadata

  • Download URL: scavio_haystack-0.1.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scavio_haystack-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dca3ed79a26bd27b9269ffb4ba23a0cf5734849e0a633fdf1309b1d63b02a8e0
MD5 eea4de1f1ff03a1e5030b903a15b1904
BLAKE2b-256 79689f8a23b5f611e8745f066d7b9fa2ed006afe862ed2cb155da7c9a5f7ac28

See more details on using hashes here.

Provenance

The following attestation bundles were made for scavio_haystack-0.1.0.tar.gz:

Publisher: release.yml on scavio-ai/haystack-scavio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scavio_haystack-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for scavio_haystack-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d9a459b91e849ef625453c70b13fb024160beb88732ba72fb377955ce52f789f
MD5 fcf7cde6abb20c6c6f043b7691ed6cb2
BLAKE2b-256 c8231956c620baa80f27500d294f41c2fa756fe65aa7d5a5701ca4a073738621

See more details on using hashes here.

Provenance

The following attestation bundles were made for scavio_haystack-0.1.0-py3-none-any.whl:

Publisher: release.yml on scavio-ai/haystack-scavio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page