feat: add Parallel Tool mode for Vertex AI#1217
Merged
ivanleomk merged 8 commits into567-labs:mainfrom Dec 18, 2024
Merged
Conversation
Contributor
There was a problem hiding this comment.
👍 Looks good to me! Reviewed everything up to c582618 in 1 minute and 12 seconds
More details
- Looked at
233lines of code in4files - Skipped
0files when reviewing. - Skipped posting
8drafted comments based on config settings.
1. instructor/client_vertexai.py:39
- Draft comment:
Remove the debug print statement or replace it with proper logging.
# print(f"Debug - Model list: {[model.__name__ for model in model_list]}")
- Reason this comment was not posted:
Confidence changes required:80%
The debug print statement is not suitable for production code and should be removed or replaced with proper logging.
2. instructor/client_vertexai.py:30
- Draft comment:
The type hint formodelsshould be updated to only includeBaseModelorlist[BaseModel].
def _create_vertexai_tool(models: Union[BaseModel, list[BaseModel]]) -> gm.Tool:
- Reason this comment was not posted:
Confidence changes required:80%
The function_create_vertexai_toolis designed to handle both single models and lists of models. However, the type hint formodelsincludesType, which is not necessary and could lead to confusion. The function should only acceptBaseModelorlist[BaseModel].
3. instructor/client_vertexai.py:104
- Draft comment:
The type hint formodelshould be updated to only includeBaseModelorlist[BaseModel].
def vertexai_process_response(_kwargs: dict[str, Any], model: Union[BaseModel, list[BaseModel]]):
- Reason this comment was not posted:
Confidence changes required:80%
The functionvertexai_process_responseis designed to handle both single models and lists of models. However, the type hint formodelincludesType, which is not necessary and could lead to confusion. The function should only acceptBaseModelorlist[BaseModel].
4. instructor/client_vertexai.py:39
- Draft comment:
Debug print statements should be removed or replaced with proper logging.
# print(f"Debug - Model list: {[model.__name__ for model in model_list]}")
- Reason this comment was not posted:
Confidence changes required:80%
The function_create_vertexai_toolininstructor/client_vertexai.pyhas a debug print statement that should be removed or replaced with proper logging.
5. instructor/client_vertexai.py:13
- Draft comment:
Function_create_gemini_json_schemashould have a return type annotation for clarity and consistency.
def _create_gemini_json_schema(model: BaseModel) -> dict[str, Any]:
- Reason this comment was not posted:
Confidence changes required:80%
The function_create_gemini_json_schemaininstructor/client_vertexai.pylacks a return type annotation, which is important for clarity and consistency.
6. instructor/client_vertexai.py:30
- Draft comment:
Function_create_vertexai_toolshould have a return type annotation for clarity and consistency.
def _create_vertexai_tool(models: Union[BaseModel, list[BaseModel], Type]) -> gm.Tool:
- Reason this comment was not posted:
Confidence changes required:80%
The function_create_vertexai_toolininstructor/client_vertexai.pylacks a return type annotation, which is important for clarity and consistency.
7. instructor/client_vertexai.py:104
- Draft comment:
Functionvertexai_process_responseshould have a return type annotation for clarity and consistency.
def vertexai_process_response(_kwargs: dict[str, Any], model: Union[BaseModel, list[BaseModel], Type]) -> tuple[list[gm.Content], list[gm.Tool], ToolConfig]:
- Reason this comment was not posted:
Confidence changes required:80%
The functionvertexai_process_responseininstructor/client_vertexai.pylacks a return type annotation, which is important for clarity and consistency.
8. instructor/dsl/parallel.py:50
- Draft comment:
Functionfrom_responseshould have a return type annotation for clarity and consistency.
def from_response(
- Reason this comment was not posted:
Confidence changes required:80%
The functionfrom_responseininstructor/dsl/parallel.pylacks a return type annotation, which is important for clarity and consistency.
Workflow ID: wflow_tx9ZvP1F3sMzVhxR
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.
c582618 to
41c1a78
Compare
Contributor
|
Verified that all vertex tests are passing locally and updated the docs |
ivanleomk
approved these changes
Dec 18, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR intends to add parallel tool mode for Vertex AI.
That is done by adding new mode
VERTEXAI_PARALLEL_TOOLS.Important
Adds
VERTEXAI_PARALLEL_TOOLSmode for parallel tool processing in Vertex AI, with updates to model handling and response processing.VERTEXAI_PARALLEL_TOOLSmode inmode.py.from_vertexai()inclient_vertexai.pyto support the new mode.handle_vertexai_parallel_tools()inprocess_response.pyto process responses in parallel.VertexAIParallelBaseinparallel.pyfor handling parallel responses.VertexAIParallelModel()inparallel.pyto create instances ofVertexAIParallelBase._create_vertexai_tool()inclient_vertexai.pyto handle multiple models.vertexai_process_response()inclient_vertexai.pyto support parallel tools._create_gemini_json_schema()inclient_vertexai.py.This description was created by
for c582618. It will automatically update as commits are pushed.