Skip to content

Remove deprecated retrieval clients from "Learn DSPy" docs #8072

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

Closed
joting0518 opened this issue Apr 15, 2025 · 3 comments · May be fixed by #8073
Closed

Remove deprecated retrieval clients from "Learn DSPy" docs #8072

joting0518 opened this issue Apr 15, 2025 · 3 comments · May be fixed by #8073
Labels
bug Something isn't working

Comments

@joting0518
Copy link

What happened?

code

import dspy
from dspy.retrieve.faiss_rm import FaissRM

Error

The terminal shows ImportError: cannot import name 'FaissRM' from 'dspy.retrieve.faiss_rm' (/Users/ting/Desktop/embedding/env/lib/python3.10/site-packages/dspy/retrieve/faiss_rm.py)

Thanks a lot!

Steps to reproduce

import dspy
from dspy.retrieve.faiss_rm import FaissRM

DSPy version

2.6.17

@joting0518 joting0518 added the bug Something isn't working label Apr 15, 2025
@joting0518 joting0518 changed the title [Bug] ImportError: cannot import name 'FaissRM' from 'dspy.retrieve.faiss_rm' (/Users/chenruoting/Desktop/mis_project/embedding/env/lib/python3.10/site-packages/dspy/retrieve/faiss_rm.py) [Bug] ImportError: cannot import name 'FaissRM' from 'dspy.retrieve.faiss_rm' Apr 15, 2025
@okhat
Copy link
Collaborator

okhat commented Apr 15, 2025

There's no FaissRM in DSPy.

You might be looking for something like:

max_characters = 6000  # for truncating >99th percentile of documents
topk_docs_to_retrieve = 5  # number of documents to retrieve per search query

with open("ragqa_arena_tech_corpus.jsonl") as f:
    corpus = [ujson.loads(line)['text'][:max_characters] for line in f]
    print(f"Loaded {len(corpus)} documents. Will encode them below.")

embedder = dspy.Embedder('openai/text-embedding-3-small', dimensions=512)
search = dspy.retrievers.Embeddings(embedder=embedder, corpus=corpus, k=topk_docs_to_retrieve)

@joting0518
Copy link
Author

FaissRM is still in the official document. Maybe you can delete it. Thanks.
https://dspy.ai/deep-dive/retrieval_models_clients/FaissRM/

@okhat
Copy link
Collaborator

okhat commented Apr 15, 2025

Ah, good catch, thanks @joting0518 !

@okhat okhat changed the title [Bug] ImportError: cannot import name 'FaissRM' from 'dspy.retrieve.faiss_rm' Remove deprecated retrieval clients from "Learn DSPy" docs Apr 15, 2025
@okhat okhat closed this as completed Apr 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants