Repository navigation
Replies: 2 comments
|
Hello @kjoth, Thanks for starting this discussion! When dealing with AI/LLM integrations, Vector DBs, or agent frameworks, quirks like this can usually be traced back to a few specific moving parts:
If you are still blocked, providing a minimal reproducible snippet or logging the raw request/response payload (scrubbed of secrets) usually helps pinpoint the exact failure layer much faster. Hope this helps point you in the right direction. Let me know if you make any progress! |
|
DSPy does not have a built-in OpenSearch retriever, but you can create a custom one by wrapping the opensearch-py client: import dspy
from opensearchpy import OpenSearch
class OpenSearchRM(dspy.Retrieve):
def __init__(self, host, index, k=3):
super().__init__(k=k)
self.client = OpenSearch(hosts=[host])
self.index = index
def forward(self, query, k=None):
k = k or self.k
body = {'query': {'match': {'content': query}}, 'size': k}
resp = self.client.search(index=self.index, body=body)
passages = [hit['_source']['content'] for hit in resp['hits']['hits']]
return dspy.Prediction(passages=passages)
dspy.settings.configure(rm=OpenSearchRM('https://localhost:9200', 'my-index'))For vector search, replace the match query with a knn query on your embedding field. This integrates cleanly with DSPy optimizers since it implements the standard Retrieve interface. |
Uh oh!
There was an error while loading. Please reload this page.
Does dspY supports OpenSearch Vector DB (https://opensearch.org/). If not are there plans to incorporate the integration.
All reactions