Skip to content

feat: add ml.llm.Claude3TextGenerator model #901

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

Merged
merged 5 commits into from
Aug 20, 2024
Merged

Conversation

GarrettWu
Copy link
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes b/359901494 🦕

@GarrettWu GarrettWu requested a review from shobsi August 14, 2024 23:44
@GarrettWu GarrettWu self-assigned this Aug 14, 2024
@GarrettWu GarrettWu requested review from a team as code owners August 14, 2024 23:44
@product-auto-label product-auto-label bot added size: l Pull request size is large. api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. labels Aug 14, 2024
@GarrettWu

This comment was marked as resolved.

@GarrettWu GarrettWu added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 16, 2024
@bigframes-bot bigframes-bot removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 16, 2024
@@ -54,6 +54,13 @@
_GEMINI_1P5_PRO_FLASH_PREVIEW_ENDPOINT,
)

_CLAUDE_3_SONNET_ENDPOINT = "claude-3-sonnet"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you add all BQML-supported models?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Leaving tests to be added.

Copy link
Contributor

@shobsi shobsi Aug 20, 2024

Choose a reason for hiding this comment

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

Sorry, I thought you were going to add tests in this PR itself. Are you going to send another PR for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. need to setup the connection for other regions.

(https://cloud.google.com/products#product-launch-stages).

Args:
model_name (str, Default to "claude-3-sonnet"):
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit] "Defaults to ..."?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We use "Default to" in all the APIs... Keeping it for now.


@log_adapter.class_logger
class Claude3TextGenerator(base.BaseEstimator):
"""Claude3 text generator LLM model.
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like "Consumer Procurement Entitlement Manager Identity and Access Management (IAM) role" is an additional requirement https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-partner-models#set-permissions, we should document this in the class docstring and after the release in the reference docs https://cloud.google.com/bigquery/docs/use-bigquery-dataframes#remote-models

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

@GarrettWu GarrettWu requested review from jiaxunwu and shobsi August 20, 2024 01:26
@GarrettWu GarrettWu enabled auto-merge (squash) August 20, 2024 01:27
@GarrettWu GarrettWu merged commit 7050038 into main Aug 20, 2024
23 checks passed
@GarrettWu GarrettWu deleted the garrettwu-claude branch August 20, 2024 17:41
@@ -145,6 +145,16 @@ def session() -> Generator[bigframes.Session, None, None]:
session.close() # close generated session at cleanup time


@pytest.fixture(scope="session")
def session_us_east5() -> Generator[bigframes.Session, None, None]:
Copy link
Contributor

Choose a reason for hiding this comment

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

Did we use it anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

forgot to remove in this PR, but will use in PR of adding tests.

@@ -54,6 +54,13 @@
_GEMINI_1P5_PRO_FLASH_PREVIEW_ENDPOINT,
)

_CLAUDE_3_SONNET_ENDPOINT = "claude-3-sonnet"
Copy link
Contributor

@shobsi shobsi Aug 20, 2024

Choose a reason for hiding this comment

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

Sorry, I thought you were going to add tests in this PR itself. Are you going to send another PR for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants