-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 search/cloud-function/python #861
base: main
Are you sure you want to change the base?
feat: Add search/cloud-function/python #861
Conversation
Co-authored-by: Holt Skinner <[email protected]>
Co-authored-by: Holt Skinner <[email protected]>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [flowbite](https://flowbite.com) ([source](https://togithub.com/themesberg/flowbite)) | [`^1.8.1` -> `^2.0.0`](https://renovatebot.com/diffs/npm/flowbite/1.8.1/2.3.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/flowbite/2.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/flowbite/2.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/flowbite/1.8.1/2.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/flowbite/1.8.1/2.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>themesberg/flowbite (flowbite)</summary> ### [`v2.3.0`](https://togithub.com/themesberg/flowbite/releases/tag/v2.3.0) [Compare Source](https://togithub.com/themesberg/flowbite/compare/v2.2.1...v2.3.0) - added new [copy to clipboard](https://flowbite.com/docs/components/clipboard/) component and examples - added new JavaScript tab to the documentation examples - update dependency to Tailwind CSS v3.4.1 - fixed carousel component behavior when there’s only one image - added new data attribute to set active and inactive classes for tabs - Ruby on Rails integration fix for turbo load - minor bug fixes and improvements ### [`v2.2.1`](https://togithub.com/themesberg/flowbite/releases/tag/v2.2.1) [Compare Source](https://togithub.com/themesberg/flowbite/compare/v2.2.0...v2.2.1) - relased new [phone number input](https://flowbite.com/docs/forms/phone-input/) component - relased new [chat bubble](https://flowbite.com/docs/components/chat-bubble/) component - updated `z-index` of the datepicker to allow usage with modals and drawers ### [`v2.2.0`](https://togithub.com/themesberg/flowbite/releases/tag/v2.2.0) [Compare Source](https://togithub.com/themesberg/flowbite/compare/v2.1.1...v2.2.0) - released new [number input](https://flowbite.com/docs/forms/number-input/) component examples - created a new `InputCounter` object class in the Flowbite JS ### [`v2.1.1`](https://togithub.com/themesberg/flowbite/releases/tag/v2.1.1) [Compare Source](https://togithub.com/themesberg/flowbite/compare/v2.1.0...v2.1.1) - fix the `InstanceOptions` and `EventListenerInstance` type exports for TypeScript ### [`v2.1.0`](https://togithub.com/themesberg/flowbite/releases/tag/v2.1.0) [Compare Source](https://togithub.com/themesberg/flowbite/compare/v2.0.0...v2.1.0) This update adds [full RTL support](https://flowbite.com/docs/customize/rtl/) to all of the UI components from Flowbite and also provides and update to the Instance Manager API which now allows you to set custom id's as the 4th parameter of each object class. - updated to Tailwind CSS `v3.3.5` - added full RTL support to all UI components - updated the JS API and Instance Manager to allow setting custom id's - added new vertical tabs component example - added three next modal component examples - fixed responsive wrapping issues for the table components - uses Tailwind CSS v3.0 classes for background opacity fixing [themesberg/flowbite#565 - other minor bug fixes and improvements Breaking changes: - `data-modal-toggle` alone won't initialise the modal anymore, you need to use `data-modal-target` for that ### [`v2.0.0`](https://togithub.com/themesberg/flowbite/releases/tag/v2.0.0) [Compare Source](https://togithub.com/themesberg/flowbite/compare/v1.8.1...v2.0.0) This update introduces a new instance manager feature that allows you manage all of the interactive components from a single place. This is useful if you want to programmatically show or hide a modal, popover, or tooltip. This also works if you use the data attributes interface. This change introduces a few breaking changes to the JavaScript API when creating objects: - new `$carouselEl` HTML element when creating a `Carousel` object as the first parameter - new `$accordion` HTML element when creating a `Accordion` object as the first parameter - new `$tabsEl` HTML element when creating a `Tabs` object as the first parameter The breaking changes do not apply to the data attributes interface, only for objects created programmatically via JavaScript. Learn more about the new [JavaScript API on the docs](https://flowbite.com/docs/getting-started/javascript/). </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/GoogleCloudPlatform/generative-ai). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMjEuMiIsInVwZGF0ZWRJblZlciI6IjM3LjMyMS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Co-authored-by: Holt Skinner <[email protected]>
add root level README the goal is for a polyglot set of examples in multiple languages
- Split functionality: - main.py does Cloud Functions - vertex_search_client.py does Vertex AI search - implemented .env configuration for settings - add unit test_vertex_search_client (mocked) - add integration test_integration_vertex_search_client (only 1 for now) Tested and working.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Moved content to README from file comment. Added docblocks to all functions and classes in main.py and vertex_search_client.py
The flexible enums were just complicated enough that they could be more trouble than they are worth - added a test file.
Enums are better, but this is already a pretty complicated example and I thought this would make it simpler. Also switched to a typed config object vs class properties on VertexSearchClient
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this overall. Tbh, a lot of what has been written here could be a good basis for a handwritten SDK
[Your RAG powered by Google Search](https://cloud.google.com/blog/products/ai-machine-learning/rags-powered-by-google-search-technology-part-1)). | ||
|
||
If you want even more control see | ||
[Vertex AI APIs for building search and RAG experiences](https://cloud.google.com/generative-ai-app-builder/docs/builder-apis), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Vertex AI APIs for building search and RAG experiences](https://cloud.google.com/generative-ai-app-builder/docs/builder-apis), | |
[Vertex AI Search Component APIs](https://cloud.google.com/generative-ai-app-builder/docs/builder-apis), |
```mermaid | ||
flowchart LR | ||
A[fa:fa-search Vertex Search AI] --> B(Google Cloud Function) | ||
B --> C[My App Server] | ||
C -->|One| D[fa:fa-laptop web] | ||
C -->|Two| E[fa:fa-mobile mobile] | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so neat! I've never seen this text based flowchart used in GitHub markdown.
quality the better the agent response based on your source data. | ||
|
||
For more on agents, check out | ||
[Agent Builder Use Cases](https://cloud.google.com/products/agent-builder?hl=en#common-uses) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Agent Builder Use Cases](https://cloud.google.com/products/agent-builder?hl=en#common-uses) | |
[Vertex AI Agent Builder Use Cases](https://cloud.google.com/products/agent-builder?hl=en#common-uses) |
If you require more extensive customization, consider using an orchestration | ||
framework like [LangChain](https://www.langchain.com/). | ||
|
||
**Take a look at other implementations in [search/cloud-functions/](../)**. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure this is needed yet
|
||
|
||
@functions_framework.http | ||
def vertex_search(request: Request) -> Tuple[str, int, Dict[str, str]]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Can this use consistent naming?
def vertex_search(request: Request) -> Tuple[str, int, Dict[str, str]]: | |
def vertex_ai_search(request: Request) -> Tuple[str, int, Dict[str, str]]: |
from typing import Generator | ||
|
||
import pytest | ||
from vertex_search_client import VertexSearchClient, VertexSearchConfig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Can this consistently be called "Vertex AI Search"?
self.client = self._create_client() | ||
self.serving_config = self._get_serving_config() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to bring these out into separate methods? They're only used the one time
Just fix the remaining lint errors or add ignores when appropriate, then this can merge. |
This is a long awaited update of a now closed PR #314. (blast from the past)
Ready:
Future:
go/vertex-ai-search-retrieval-gemini-generate)