-
Notifications
You must be signed in to change notification settings - Fork 12
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(provider): add Google VertexAI support #24
base: main
Are you sure you want to change the base?
feat(provider): add Google VertexAI support #24
Conversation
Signed-off-by: David Anyatonwu <[email protected]>
Signed-off-by: David Anyatonwu <[email protected]>
…tting - Changed project_id retrieval to use expect for mandatory parameter. - Updated location retrieval to use unwrap_or for default value. - Modified endpoint formatting to dynamically include location in the URL for both chat and embeddings requests. - Refactored test provider setup to use constants for project_id and location.
@galkleinman This PR is ready for review. running 9 tests
test providers::vertexai::tests::test_chat_completions_with_api_key ... ignored, Requires valid API key which is not available yet
test providers::vertexai::provider::tests::test_gemini_request_conversion ... ok
test providers::vertexai::provider::tests::test_gemini_response_conversion ... ok
test providers::vertexai::provider::tests::test_provider_new_missing_project_id - should panic ... ok
test providers::vertexai::provider::tests::test_provider_new ... ok
test providers::vertexai::tests::test_chat_completions ... ok
test providers::vertexai::tests::test_chat_completions_with_tools ... ok
test providers::vertexai::tests::test_embeddings ... ok
test providers::vertexai::tests::test_completions ... ok
test result: ok. 8 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 3.32s
Running unittests src/main.rs (target/debug/deps/hub-e2c6417f88e881cd)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests hub
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s ![]() |
- Introduced a new method `validate_location` to sanitize and validate location input, defaulting to "us-central1" if invalid. - Updated the provider initialization to utilize the new location validation method. - Added extensive unit tests for the provider, covering various scenarios including location validation, request conversion, and handling of empty messages. - Ensured that invalid characters in location parameters are filtered out correctly. - Enhanced tests to verify the precedence of API key over credentials path in configuration. This commit improves the robustness of the VertexAIProvider by ensuring valid location formats and enhancing test coverage.
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.
Hey @onyedikachi-david - left a lot of comments. You're code isn't following idiomatic rust constructs and it's not following other providers already implemented in this repo. You're also missing integration (black box) tests which tests the whole system - not just the provider.
.collect(); | ||
|
||
if sanitized.is_empty() { | ||
"us-central1".to_string() // Default if invalid |
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.
why?
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.
for say the user didn't configure one
} | ||
} | ||
|
||
#[cfg(test)] |
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 should not be here, it belongs to the test file
|
||
} | ||
|
||
#[cfg(test)] |
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.
why is it here?
addressed your reviews @nirga |
Add Google VertexAI Provider Support
This PR adds support for Google VertexAI models (Gemini) as a new provider in the Hub, allowing users to route their LLM requests to Google's models through our unified API interface.
Definition of Done
Changes Made
Added new VertexAI provider implementation
Added comprehensive test suite
Updated documentation
Added robust configuration support
Testing
cargo test
Security Considerations
Notes
Fixes #19
/claim #19