From a05dff513b17be96ced0f308679f4aceeeb25810 Mon Sep 17 00:00:00 2001 From: emrgnt-cmplxty <68796651+emrgnt-cmplxty@users.noreply.github.com> Date: Sun, 30 Jun 2024 18:40:34 -0700 Subject: [PATCH] Feature/fix cli and readme rebased (#593) * unpack, and fix docs to reflect this (#583) * fix readme (#587) * fix readme --- README.md | 18 ++++-------------- r2r/cli/cli.py | 2 +- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index a8626d6e4..ce989cda1 100644 --- a/README.md +++ b/README.md @@ -245,26 +245,16 @@ app.ingest_documents( rag_results = app.rag( "Who is john", GenerationConfig(model="gpt-3.5-turbo", temperature=0.0) ) -print(f"Search Results:\n{response['search_results']}") -print(f"Completion:\n{response['completion']}") +print(f"Search Results:\n{rag_results.search_results}") +print(f"Completion:\n{rag_results.completion}") # RAG Results: - # Search Results: -# {'vector_search_results': [ -# {'id': '7ed3a01c-88dc-5a58-a68b-6e5d9f292df2', -# 'score': 0.7802911996841491, -# 'metadata': {'text': 'Aristotle[A] (Greek: Ἀριστοτέλης Aristotélēs, pronounced [aristotélɛːs]; 384–322 BC) was an Ancient Greek philosopher and polymath. His writings cover a broad range of subjects spanning the natural sciences, philosophy, linguistics, economics, politics, psychology, and the arts. As the founder of the Peripatetic schoo -# ... +# AggregateSearchResult(vector_search_results=[VectorSearchResult(id=2d71e689-0a0e-5491-a50b-4ecb9494c832, score=0.6848798582029441, metadata={'text': 'John is a person that works at Google.', 'version': 'v0', 'chunk_order': 0, 'document_id': 'ed76b6ee-dd80-5172-9263-919d493b439a', 'extraction_id': '1ba494d7-cb2f-5f0e-9f64-76c31da11381', 'associatedQuery': 'Who is john'})], kg_search_results=None) # Completion: -# {'results': [ -# { -# 'id': 'chatcmpl-9eXL6sKWlUkP3f6QBnXvEiKkWKBK4', -# 'choices': [ -# ... +# ChatCompletion(id='chatcmpl-9g0HnjGjyWDLADe7E2EvLWa35cMkB', choices=[Choice(finish_reason='stop', index=0, logprobs=None, message=ChatCompletionMessage(content='John is a person that works at Google [1].', role='assistant', function_call=None, tool_calls=None))], created=1719797903, model='gpt-3.5-turbo-0125', object='chat.completion', service_tier=None, system_fingerprint=None, usage=CompletionUsage(completion_tokens=11, prompt_tokens=145, total_tokens=156)) ``` - # R2R Dashboard Interact with R2R using our [open-source React+Next.js dashboard](https://github.com/SciPhi-AI/R2R-Dashboard). Check out the [Dashboard Cookbook](https://r2r-docs.sciphi.ai/cookbooks/dashboard) to get started! diff --git a/r2r/cli/cli.py b/r2r/cli/cli.py index 1db10846b..51b284bf9 100644 --- a/r2r/cli/cli.py +++ b/r2r/cli/cli.py @@ -87,7 +87,7 @@ def ingest(obj, file_paths, no_media): file_paths = list(file_paths) if not file_paths: root_path = os.path.dirname(os.path.abspath(__file__)) - file_paths = [os.path.join(root_path, "data", "aristotle.txt")] + file_paths = [os.path.join(root_path, "..", "examples", "data", "aristotle.txt")] if no_media: excluded_types = ["jpeg", "jpg", "png", "svg", "mp3", "mp4"]