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

feat(generative-ai): Add compute token examples #12638

Closed
wants to merge 13 commits into from
Closed

Conversation

msampathkumar
Copy link
Member

Add list_tokens_example

Description

Fixes b358102024

Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.

Checklist

@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Sep 26, 2024
Copy link

snippet-bot bot commented Sep 26, 2024

Here is the summary of changes.

You are about to add 5 region tags.
You are about to delete 4 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

@msampathkumar msampathkumar added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 27, 2024
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 27, 2024
@msampathkumar
Copy link
Member Author

CICD error google.api_core.exceptions.ResourceExhausted: 429 Resource exhausted.

Need to re-try after sometime.

@msampathkumar msampathkumar added the kokoro:run Add this label to force Kokoro to re-run the tests. label Oct 3, 2024
@davidcavazos
Copy link
Contributor

davidcavazos commented Oct 3, 2024

It's running 148 tests every time changes get pushed, which might explain the resource exhausted errors. It looks like it's running everything under generative_ai/ because the noxfile_config.py is located there. To avoid running everything, try adding a noxfile_config.py along with the necessary requirements.txt and requirements-test.txt under generative_ai/count_token/. That way you can also trim down the dependencies for that specific directory.

It would be nice to do the same for all the other subdirectories too. That would avoid running so many redundant tests and would lower resource usage.

@kokoro-team kokoro-team removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Oct 4, 2024
@msampathkumar
Copy link
Member Author

msampathkumar commented Oct 4, 2024

@davidcavazos - Thank you for the detailed steps. Will do as suggested. We are currently working on re-organising the samples into feature folder. go/runnable-snippets-execute

It's running 148 tests every time changes get pushed, which might explain the resource exhausted errors. It looks like it's running everything under generative_ai/ because the noxfile_config.py is located there. To avoid running everything, try adding a noxfile_config.py along with the necessary requirements.txt and requirements-test.txt under generative_ai/count_token/. That way you can also trim down the dependencies for that specific directory.

It would be nice to do the same for all the other subdirectories too. That would avoid running so many redundant tests and would lower resource usage.

generative_ai/count_token/requirements.txt Outdated Show resolved Hide resolved
generative_ai/count_token/requirements.txt Show resolved Hide resolved
generative_ai/count_token/test_token_count.py Outdated Show resolved Hide resolved
msampathkumar and others added 2 commits October 4, 2024 17:31
Co-authored-by: Holt Skinner <13262395+holtskinner@users.noreply.github.com>
Co-authored-by: Holt Skinner <13262395+holtskinner@users.noreply.github.com>
@davidcavazos
Copy link
Contributor

@msampathkumar thanks for providing the local directory test config. It looks like it's still running everything, not your fault.

After closer inspection at the code that detects the test package directory, it looks like it dives deeper from the repo root directory until it finds a requirements.txt file. I would have imagined it would bubble up from the diffs it found, so it'll keep running everything until the generative_ai/requirements.txt file is gone.

btlr run --max-cmd-duration=60m **/requirements.txt --git-diff origin/main... . -- /workspace/.kokoro/tests/run_single_test.sh

https://github.com/googleapis/btlr/blob/main/cmd/run.go#L325 <- finds most general instead of most specific

@msampathkumar
Copy link
Member Author

All count token related tests are passing. Error are related to Embedding and FunctionCalling. Re-running the test

@msampathkumar msampathkumar added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 8, 2024
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 8, 2024
@msampathkumar
Copy link
Member Author

Function calling code sample is failing repeatedly for 002 version and so using 001

@msampathkumar msampathkumar added the automerge Merge the pull request once unit tests and other checks pass. label Oct 8, 2024
@msampathkumar
Copy link
Member Author

Raising fresh independent PRs

@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Oct 8, 2024
@msampathkumar
Copy link
Member Author

msampathkumar commented Oct 8, 2024

#12684

#12683

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.

5 participants