Skip to content
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

refactor: (GenAI) Reorganized Rag Samples (Group С) #12612

Merged
merged 4 commits into from
Oct 1, 2024

Conversation

Thoughtseize1
Copy link
Contributor

@Thoughtseize1 Thoughtseize1 commented Sep 20, 2024

Description

Created new /generative_ai/rag folder.
I left the skip mark on tests but I fixed them all.

Region_tag New file
generativeaionvertexai_rag_retrieval_query retrieval_query_example.py
generativeaionvertexai_rag_generate_content generate_content_example.py
generativeaionvertexai_rag_quickstart quickstart_example.py
generativeaionvertexai_rag_import_files import_files_example.py
generativeaionvertexai_rag_import_files_async import_files_async_example.py
generativeaionvertexai_rag_get_file get_file_example.py
generativeaionvertexai_rag_list_files list_files_example.py
generativeaionvertexai_rag_delete_file delete_file_example.py
generativeaionvertexai_rag_delete_corpus delete_corpus_example.py
generativeaionvertexai_rag_create_corpus create_corpus_example.py
generativeaionvertexai_rag_get_corpus get_corpus_example.py
generativeaionvertexai_rag_list_corpora list_corpora_example.py
generativeaionvertexai_rag_upload_file upload_file_example.py

Actions after approval:

  1. Delete /generative_ai/rag.py and /generative_ai/rag_test.py files
  2. Rename generative_ai/rag/test_rag.py -> rag_test.py

❗If we want our tests to run successfully, we need to remove the skip marker and ensure that the necessary permissions are granted in the test environment.

Currently, we are catching the following error when tests are running:
google.auth.exceptions.RefreshError: ('invalid_scope: Invalid OAuth scope or ID token audience provided.', {'error': 'invalid_scope', 'error_description': 'Invalid OAuth scope or ID token audience provided.'})

Checklist

@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Sep 20, 2024
@Thoughtseize1 Thoughtseize1 added the snippet-bot:force-run Force snippet-bot runs its logic label Sep 20, 2024
@snippet-bot snippet-bot bot removed the snippet-bot:force-run Force snippet-bot runs its logic label Sep 20, 2024
Copy link

snippet-bot bot commented Sep 20, 2024

Here is the summary of changes.

You are about to add 13 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@Thoughtseize1 Thoughtseize1 marked this pull request as ready for review September 20, 2024 14:03
@Thoughtseize1 Thoughtseize1 requested review from a team as code owners September 20, 2024 14:03

# TODO(developer): Update and un-comment below lines
# PROJECT_ID = "your-project-id"
# corpus_name = "projects/{PROJECT_ID}/locations/us-central1/ragCorpora/{rag_corpus_id}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: This can be either format:

projects/{project}/locations/{location}/ragCorpora/{rag_corpus}
or {rag_corpus}


# TODO(developer): Update and un-comment below lines
# PROJECT_ID = "your-project-id"
# file_name = "projects/{PROJECT_ID}/locations/us-central1/ragCorpora/{rag_corpus_id}/ragFiles/{rag_file_id}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: this can be either a full file path or the user can pass a corpus id and the file id to the method.

From the library:

Args

name
Either a full RagFile resource name must be provided, or a RagCorpus name and a RagFile name must be provided. Format:

    ``projects/{project}/locations/{location}/ragCorpora/{rag_corpus}/ragFiles/{rag_file}``
    or ``{rag_file}``.

corpus_name
If name is not a full resource name, an existing RagCorpus name must be provided. Format:

    ``projects/{project}/locations/{location}/ragCorpora/{rag_corpus}``
    or ``{rag_corpus}``.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a tracker to re-check this @ #12658


# TODO(developer): Update and un-comment below lines
# PROJECT_ID = "your-project-id"
# corpus_name = "projects/{PROJECT_ID}/locations/us-central1/ragCorpora/{rag_corpus_id}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar as before, this parameter can be the full path or just the corpus id

rag_corpus
A Rag corpus resource name or corpus id. Format:

    ``projects/{project}/locations/{location}/ragCorpora/{rag_corpus_id}``
    or ``{rag_corpus_id}``.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a tracker to re-check this @ #12658


# TODO(developer): Update and un-comment below lines
# PROJECT_ID = "your-project-id"
# corpus_name = "projects/{PROJECT_ID}/locations/us-central1/ragCorpora/{rag_corpus_id}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as before re: full resource names


# TODO(developer): Update and un-comment below lines
# PROJECT_ID = "your-project-id"
# corpus_name = "projects/{PROJECT_ID}/locations/us-central1/ragCorpora/{rag_corpus_id}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as before re: full resource paths


# TODO(developer): Update and un-comment below lines
# PROJECT_ID = "your-project-id"
# corpus_name = "projects/{PROJECT_ID}/locations/us-central1/ragCorpora/{rag_corpus_id}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as before re: full resource paths


# TODO(developer): Update and un-comment below lines
# PROJECT_ID = "your-project-id"
# corpus_name = "projects/[PROJECT_ID]/locations/us-central1/ragCorpora/[rag_corpus_id]"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as before re: full resource paths


# TODO(developer): Update and un-comment below lines
# PROJECT_ID = "your-project-id"
# corpus_name = "projects/{PROJECT_ID}/locations/us-central1/ragCorpora/{rag_corpus_id}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as before re: full resource names

@Thoughtseize1
Copy link
Contributor Author

Separated document with detailed description of issue.

@Thoughtseize1
Copy link
Contributor Author

@holtskinner PTAL

@msampathkumar
Copy link
Member

Create a tracker to re-check the mentioned comment @ #12658

For now, proceeding with the migration work.

@msampathkumar msampathkumar merged commit cbd4f4f into main Oct 1, 2024
14 checks passed
@msampathkumar msampathkumar deleted the Reorganize-GenAI-Samples-Rag branch October 1, 2024 12:47
riathakkar pushed a commit to riathakkar/python-docs-samples that referenced this pull request Oct 8, 2024
…orm#12612)

* New Samples for Rag folder

* Try to run test with created test_file.txt

* Returned pytest.skip mark

* Added type annotations for Python 3.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants