Closed levnikolaevich closed 5 months ago
ah thanks for raising this @levnikolaevich . the proper import line should be from dspy.retrieve.faiss_rm import FaissRM
. Will update this in the documentation (but lmk if that doesn't work either!)
Thank you very much! Everything works! Will you close this topic yourself?
How to save this vectorstore locally?
Hello!
I'm trying to replicate an example from the documentation in Google Colab. https://dspy-docs.vercel.app/api/retrieval_model_clients/FaissRM
I'm encountering a problem.
================= import sys import os
import google.colab repo_path = 'dspy' !git -C $repo_path pull origin || git clone https://github.com/stanfordnlp/dspy $repo_path
if repo_path not in sys.path: sys.path.append(repo_path)
os.environ["DSP_NOTEBOOK_CACHEDIR"] = os.path.join(repo_path, 'cache')
import pkg_resources # Install the package if it's not installed if not "dspy-ai" in {pkg.key for pkg in pkg_resources.working_set}: !pip install -U pip
!pip install dspy-ai
!pip install transformers !pip install accelerate
================= import dspy from dspy.retrieve import FaissRM
document_chunks = [ "The superbowl this year was played between the San Francisco 49ers and the Kanasas City Chiefs", "Pop corn is often served in a bowl", ]
frm = FaissRM(document_chunks) turbo = dspy.OpenAI(model="gpt-3.5-turbo") dspy.settings.configure(lm=turbo, rm=frm) print(frm(["I am in the mood for Chinese food"]))
ImportError Traceback (most recent call last) in <cell line: 2>()
1 import dspy
----> 2 from dspy.retrieve import FaissRM
3
4 document_chunks = [
5 "The superbowl this year was played between the San Francisco 49ers and the Kanasas City Chiefs",
ImportError: cannot import name 'FaissRM' from 'dspy.retrieve' (/content/dspy/dspy/retrieve/init.py)
Have the same problem locally too.
Could you please advise what I might be doing wrong? Or is this an error?
Thank you very much in advance!