Feedback for “Local Rag”
jamesfishwick opened this issue · comments
Excited to dig into this project!
I'm going through the tutorial. Does r2r know how to load the config files from the examples/configs
folder when I enter python -m r2r.examples.servers.basic_pipeline --config local_ollama
? I'm getting this error:
python -m r2r.examples.servers.basic_pipeline --config local_ollama
/Users/usr/.local/lib/python/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
warnings.warn(
INFO:r2r.embeddings.openai.base:Initializing `OpenAIEmbeddingProvider` to provide embeddings.
Traceback (most recent call last):
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Users/usr/.local/lib/python/site-packages/r2r/examples/servers/basic_pipeline.py", line 27, in <module>
app = create_app()
File "/Users/usr/.local/lib/python/site-packages/r2r/examples/servers/basic_pipeline.py", line 21, in create_app
app = E2EPipelineFactory.create_pipeline(
File "/Users/usr/.local/lib/python/site-packages/r2r/main/factory.py", line 107, in create_pipeline
or E2EPipelineFactory.get_embeddings_provider(config.embedding)
File "/Users/usr/.local/lib/python/site-packages/r2r/main/factory.py", line 50, in get_embeddings_provider
return OpenAIEmbeddingProvider()
File "/Users/usr/.local/lib/python/site-packages/r2r/embeddings/openai/base.py", line 35, in __init__
raise ValueError(
ValueError: Must set OPENAI_API_KEY in order to initialize OpenAIEmbeddingProvider."
I think it's trying to read the config from a location not specified in the tutorial. As it is looking for "OPENAI_API_KEY." But where that is needs to be clarified.
Hey James,
Thanks for providing this feedback quickly. You should not be encountering this error, let me attempt to debug right now and report back. Are you confident that you are on the latest commit?
Hey again James,
I see that we fixed this in main branch but failed to publish an updated release to pypi after we broke the tutorial. I've just done so, can you confirm that the tutorial now works on your end (you should be able to test with pip install 'r2r[eval,local_llm]' --upgrade
.
That did it. Thanks! If I wanted to use my custom config, can you confirm that I can add an arbitrary one (say, foobar.json
to examples/configs
and call it with --config foobar
?
Awesome!
What you are asking about would be reasonable expected behavior, but right now it isn't supported since the example was written assuming a pip install.
If you want to run with your own custom config, you'd need to build a pipeline yourself like so -
from r2r.main import E2EPipelineFactory, R2RConfig
app = E2EPipelineFactory.create_pipeline(
config=R2RConfig.load_config(config_path)
)