https://github.com/deepset-ai/haystack-client-py
Simple Python client to interact with Haystack and Haystack Hub instances to embed search functionality in other applications.
https://github.com/deepset-ai/haystack-client-py
Last synced: 5 months ago
JSON representation
Simple Python client to interact with Haystack and Haystack Hub instances to embed search functionality in other applications.
- Host: GitHub
- URL: https://github.com/deepset-ai/haystack-client-py
- Owner: deepset-ai
- License: apache-2.0
- Created: 2021-04-28T08:33:28.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-05T17:02:10.000Z (about 4 years ago)
- Last Synced: 2025-04-12T15:14:26.132Z (9 months ago)
- Language: Python
- Size: 64.5 KB
- Stars: 0
- Watchers: 13
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# haystack-client-py
Simple Python client to interact with Haystack and Haystack Hub instances to embed search functionality in other applications.
> :warning: This project is in active development and is not yet ready for use.
### Example
```
from haystack_client import HaystackClient, HaystackHubClient
# Choose between open-source and SaaS deployments
client = HaystackClient(host="http://localhost:8000")
# client = HaystackHubClient(user="some_user", password="some_pass")
# Get docs
docs = client.get_documents()
# print results
for d in docs[:2]:
print(d.content)
# Run a search query
answers = client.search(query="Who is the father of Arya Stark?", params={})
print(answers)
# Returns:
# {'answers': [{'answer': 'Ned',
# 'context': '\n'
# '====Season 1====\n'
# 'Arya accompanies her father Ned and her sister Sansa '
# "to King's Landing. Before their departure, Arya's "
# 'half-brother Jon Snow gifts A',
# 'document_id': '180c2a6b36369712b361a80842e79356',
# 'meta': {'name': '43_Arya_Stark.txt'},
# 'offsets_in_context': [{'end': 49, 'start': 46}],
# 'offsets_in_document': [{'end': 49, 'start': 46}],
# 'score': 0.9767240881919861,
# 'type': 'extractive'},
# ...
...
```