Add separate agent_base_url for OpenAI-compatible completions endpoint & Fix CLI test terminal width issue#154
Add separate agent_base_url for OpenAI-compatible completions endpoint & Fix CLI test terminal width issue#154salvirezwan wants to merge 1 commit intovlm-run:mainfrom
Conversation
…ndpoint; fix CLI test terminal width
Summary of ChangesHello @salvirezwan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the 'VLMRun' client's flexibility by introducing a dedicated configuration option for its OpenAI-compatible completions endpoint, allowing it to operate independently from the main API base URL. This change provides more granular control over endpoint routing. Additionally, it addresses a testing fragility by ensuring CLI output tests are robust against varying terminal widths. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request successfully introduces the agent_base_url parameter to the VLMRun client, allowing for independent configuration of the OpenAI-compatible completions endpoint. It also correctly addresses a terminal width issue in CLI tests. I have identified one medium-severity issue regarding an unused parameter in the CLI chat command that could lead to confusion.
| base_url: Optional[str] = typer.Option( | ||
| os.getenv("VLMRUN_BASE_URL", DEFAULT_BASE_URL), | ||
| os.getenv("VLMRUN_AGENT_BASE_URL", os.getenv("VLMRUN_BASE_URL", DEFAULT_BASE_URL)), | ||
| "--base-url", | ||
| help="VLM Run Agent API base URL.", | ||
| help="VLM Run Agent API base URL. Falls back to VLMRUN_AGENT_BASE_URL, then VLMRUN_BASE_URL.", | ||
| ), |
There was a problem hiding this comment.
The base_url parameter defined here is currently unused within the chat function body. Since the VLMRun client is initialized in the parent command group (vlmrun/cli/cli.py) and passed via ctx.obj, this local option does not affect the client's configuration.
If the intention is to allow overriding the agent URL specifically for the chat command, you should apply this value to the client instance inside the function (e.g., client.agent_base_url = base_url). Additionally, consider renaming this option to --agent-base-url to maintain consistency with the client property and avoid confusion with the global --base-url option.
Summary
agent_base_urlparameter on theVLMRunclient, allowing the agent/OpenAI-compatible completions endpoint to be configured independently from the main API base URL. Falls back toVLMRUN_AGENT_BASE_URLenv var, then tobase_url.Agentclass, CLIchatcommand, type protocol, and mock client to use the newagent_base_url.COLUMNS=200to prevent Rich table truncation in narrow terminal widths.Changes
vlmrun/client/client.py— Addagent_base_urlattribute with env var / fallback resolutionvlmrun/client/agent.py— Useagent_base_urlfor OpenAI client (sync + async)vlmrun/types/abstract.py— Addagent_base_urltoVLMRunProtocolvlmrun/cli/_cli/chat.py— Update--base-urlto checkVLMRUN_AGENT_BASE_URLfirsttests/conftest.py— Update mock client to supportagent_base_urltests/cli/test_cli_predictions.py— Fix terminal width for table output tests