-
Notifications
You must be signed in to change notification settings - Fork 353
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: add metadata field in _GenerativeModels class methods to pass the metadata down the method chain. #3491
base: main
Are you sure you want to change the base?
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
…he value along to down the chain methods
af5f786
to
ca963f6
Compare
@vi3k6i5 Thank you for the contribution! Please update/add unit tests. |
…a and send_message for chat
@sasha-gitg Can you help with the Presubmits, the PRs are in waiting state for Presubmits to finish for last 5 days. Any idea, how to resolve that ? |
-- da82c4a by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>: feat: add function_calling_config to ToolConfig feat: add tool_config to GenerateContentRequest PiperOrigin-RevId: 617966568 Source-Link: googleapis/googleapis@02cf73b Source-Link: https://github.com/googleapis/googleapis-gen/commit/9cc372f4eb562456dd6e1731a0d10919b478c839 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOWNjMzcyZjRlYjU2MjQ1NmRkNmUxNzMxYTBkMTA5MTliNDc4YzgzOSJ9 -- 91b6199 by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>: 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md -- b8531a1 by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>: chore: Update gapic-generator-python to v1.16.1 PiperOrigin-RevId: 618243632 Source-Link: googleapis/googleapis@078a38b Source-Link: https://github.com/googleapis/googleapis-gen/commit/7af768c3f8ce58994482350f7401173329950a31 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiN2FmNzY4YzNmOGNlNTg5OTQ0ODIzNTBmNzQwMTE3MzMyOTk1MGEzMSJ9 -- 9499f80 by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>: 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md -- 9b6313a by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>: feat: Add Optimized feature store proto feat: Add data_key field in feature online store service feat: Add dedicated_serving_endpoint feat: Add index_config field PiperOrigin-RevId: 618280080 Source-Link: googleapis/googleapis@d81d0b9 Source-Link: https://github.com/googleapis/googleapis-gen/commit/a96b4d818e3d157e6f529616ad7b147d3f8aa387 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYTk2YjRkODE4ZTNkMTU3ZTZmNTI5NjE2YWQ3YjE0N2QzZjhhYTM4NyJ9 -- 9f8e913 by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>: 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md COPYBARA_INTEGRATE_REVIEW=googleapis#3493 from googleapis:owl-bot-copy 9f8e913 PiperOrigin-RevId: 618911337
PiperOrigin-RevId: 619003239
PiperOrigin-RevId: 619340751
PiperOrigin-RevId: 619453719
…n using pre-built container PiperOrigin-RevId: 619575247
PiperOrigin-RevId: 619580451
PiperOrigin-RevId: 619596185
…on support for Imagen 2 Changelog: Changed the following parameters internally: - `editConfig` to `editConfigV6` - `segmentationClasses` to `classes` - `safetyFilterLevel` to `safetySetting` PiperOrigin-RevId: 619620158
PiperOrigin-RevId: 619713321
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
This reverts commit 44ab3d4.
-- ccbbe38 by release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>: chore(main): release 1.45.0 COPYBARA_INTEGRATE_REVIEW=googleapis#3443 from googleapis:release-please--branches--main ccbbe38 PiperOrigin-RevId: 619994937
…nt parameters Changed flags: `maskMode` is it's own struct in the API, encapsulating `maskType` and `classes` `maskMode` can only be set (even to an empty value) if two conditions are satisfied: - `mask` is None - `editMode` is not `product-image` The logic now reflects this PiperOrigin-RevId: 620092866
PiperOrigin-RevId: 620105958
The Automatic Function Calling (AFC) feature automates the function calling handling. AFC reduces manual user steps when using Function Calling. AFC makes it easy to use native functions (e.g. Python) with the Function Calling feature. AFC makes it possible for the user to instruct the SDK to let the model call the user-provided functions automatically. AFC can be enabled when starting a chat. Usage: ```python from vertexai.preview.generative_models import GenerativeModel, FunctionCallingConfig, FunctionDeclaration, Tool def get_current_weather(location: str, unit: str = "centigrade"): """Gets weather in the specified location. Args: location: The location for which to get the weather. unit: Optional. Temperature unit. Can be Centigrade or Fahrenheit. Defaults to Centigrade. Returns: The weather information as a dict. """ # Add actual implementation. return dict( location=location, unit=unit, weather="Super nice, but maybe a bit hot.", ) get_current_weather_declaration = FunctionDeclaration.from_func(get_current_weather) weather_tool = Tool([get_current_weather_declaration]) fc_model = GenerativeModel("gemini-pro", tools=[weather_tool]) afc_responder = AutomaticFunctionCallingResponder( # Optional: max_number_of_automatic_function_calls=5, ) chat = model.start_chat(responder=afc_responder) fc_chat.send_message("What is the weather like in Boston?") ``` PiperOrigin-RevId: 620189258
…tainers PiperOrigin-RevId: 620427553
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
…he value along to down the chain methods
…a and send_message for chat
…a and send_message for chat
@vi3k6i5 @sasha-gitg will this be merged into the Python SDK? In the JavAscript SDK, currently it's possible to send headers and modify other request options (like the baseUrl) this way: const model = googleGenAIClient.getGenerativeModel(
{ model: "gemini-pro" },
{
customHeaders: {
"x-param": "<PARAMETER>",
},
baseUrl: env.PROXY_URL,
}
); I wonder why a similar functionality was not added to the Python SDK It almost feels like it was close to be considered, but it was not finished. See these links: |
Fixes #3490