Skip to content

Commit

Permalink
Ellipsis fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
NolanTrem committed Aug 21, 2024
1 parent e639c8a commit 807988f
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 12 deletions.
8 changes: 6 additions & 2 deletions py/cli/commands/retrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
@click.option(
"--search-limit", default=None, help="Number of search results to return"
)
@click.option("--use-hybrid-search", is_flag=True, help="Perform hybrid search")
@click.option(
"--use-hybrid-search", is_flag=True, help="Perform hybrid search"
)
@click.option(
"--selected-group-ids", type=JSON, help="Group IDs to search for as a JSON"
)
Expand Down Expand Up @@ -122,7 +124,9 @@ def search(client, query, **kwargs):
@click.option(
"--search-limit", default=10, help="Number of search results to return"
)
@click.option("--use-hybrid-search", is_flag=True, help="Perform hybrid search")
@click.option(
"--use-hybrid-search", is_flag=True, help="Perform hybrid search"
)
@click.option(
"--selected-group-ids", type=JSON, help="Group IDs to search for as a JSON"
)
Expand Down
4 changes: 2 additions & 2 deletions py/core/examples/hello_r2r.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
query="Who is john",
rag_generation_config={"model": "gpt-3.5-turbo", "temperature": 0.0},
)
results = rag_response['results']
results = rag_response["results"]
print(f"Search Results:\n{results['search_results']}")
print(f"Completion:\n{results['completion']}")

# RAG Results:
# Search Results:
# 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:
# 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))
# 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))
9 changes: 6 additions & 3 deletions py/core/main/services/ingestion_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,12 @@ async def update_files(
message="Number of ids does not match number of files.",
)
else:
document_ids = [generate_user_document_id(file.filename, user.id) for file in files]
print('user_id = ', user.id)
print('document_ids = ', document_ids)
document_ids = [
generate_user_document_id(file.filename, user.id)
for file in files
]
print("user_id = ", user.id)
print("document_ids = ", document_ids)
# Only superusers can modify arbitrary document ids, which this gate guarantees in conjuction with the check that follows
documents_overview = (
(
Expand Down
7 changes: 4 additions & 3 deletions py/sdk/ingestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ async def ingest_files(
raise ValueError(
"Number of versions must match number of document IDs."
)
if chunking_settings is not None and chunking_settings is not ChunkingConfig:
if (
chunking_settings is not None
and chunking_settings is not ChunkingConfig
):
# check if the provided dict maps to a ChunkingConfig
ChunkingConfig(**chunking_settings)


all_file_paths = []
for path in file_paths:
Expand Down Expand Up @@ -121,7 +123,6 @@ async def update_files(
raise ValueError(
"Number of file paths must match number of document IDs."
)


with ExitStack() as stack:
files = [
Expand Down
2 changes: 1 addition & 1 deletion py/tests/cli/commands/test_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def test_delete_invalid_filter(runner, mock_r2r_client):
assert result.exit_code != 0


def test_documents_overview_with_document_id(runner, mock_r2r_client):
def test_documents_overview_without_document_id(runner, mock_r2r_client):
result = runner.invoke(
cli,
[
Expand Down
2 changes: 1 addition & 1 deletion py/tests/cli/commands/test_restructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def new_callback(*args, **kwargs):

yield mock_client

cli.callback = None
cli.callback = original_callback


def test_enrich_graph(runner, mock_r2r_client):
Expand Down

0 comments on commit 807988f

Please sign in to comment.