Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dspy.Retrieve cannot read csv file #1291

Closed
Hughhuh opened this issue Jul 19, 2024 · 1 comment
Closed

dspy.Retrieve cannot read csv file #1291

Hughhuh opened this issue Jul 19, 2024 · 1 comment

Comments

@Hughhuh
Copy link

Hughhuh commented Jul 19, 2024

retrieve = dspy.Retrieve(k=3)
topK_passages = retrieve(dev_example.product).passages

print(f"Top {retrieve.k} passages for question: {dev_example.product} \n", '-' * 30, '\n')

for idx, passage in enumerate(topK_passages):
print(f'{idx+1}]', passage, '\n')


TypeError Traceback (most recent call last)
Cell In[19], line 3
1 dspy.settings.configure(rm=dataset)
2 retrieve = dspy.Retrieve(k=3)
----> 3 topK_passages = retrieve(dev_example.product).passages
5 print(f"Top {retrieve.k} passages for question: {dev_example.product} \n", '-' * 30, '\n')
7 for idx, passage in enumerate(topK_passages):

File /opt/conda/lib/python3.10/site-packages/dspy/retrieve/retrieve.py:40, in Retrieve.call(self, *args, **kwargs)
39 def call(self, *args, **kwargs):
---> 40 return self.forward(*args, **kwargs)

File /opt/conda/lib/python3.10/site-packages/dspy/retrieve/retrieve.py:69, in Retrieve.forward(self, query_or_queries, k, by_prob, with_metadata, **kwargs)
67 k = k if k is not None else self.k
68 if not with_metadata:
---> 69 passages = dsp.retrieveEnsemble(queries, k=k, by_prob=by_prob, **kwargs)
70 return Prediction(passages=passages)
71 else:

File /opt/conda/lib/python3.10/site-packages/dsp/primitives/search.py:93, in retrieveEnsemble(queries, k, by_prob, **kwargs)
90 queries = [q for q in queries if q]
92 if len(queries) == 1:
---> 93 return retrieve(queries[0], k, **kwargs)
95 passages = {}
96 for q in queries:

File /opt/conda/lib/python3.10/site-packages/dsp/primitives/search.py:14, in retrieve(query, k, **kwargs)
12 if not dsp.settings.rm:
13 raise AssertionError("No RM is loaded.")
---> 14 passages = dsp.settings.rm(query, k=k, **kwargs)
15 if not isinstance(passages, Iterable):
16 # it's not an iterable yet; make it one.
17 # TODO: we should unify the type signatures of dspy.Retriever
18 passages = [passages]

TypeError: 'list' object is not callable

@Hughhuh Hughhuh closed this as completed Jul 19, 2024
@Hughhuh Hughhuh reopened this Jul 19, 2024
@okhat
Copy link
Collaborator

okhat commented Jul 21, 2024

I don't understand why you expect dspy.Retrieve to be able to read csv files.

@okhat okhat closed this as completed Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants