-
Notifications
You must be signed in to change notification settings - Fork 2
By sending session id as request body, removed vlmrun[cli] compatibality issue as it used OpenAI client which did not support session id #145
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
base: main
Are you sure you want to change the base?
Conversation
…ity issue as it used OpenAI client which did not support session id
Summary of ChangesHello @MehediAhamed, 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 addresses a critical compatibility problem within the VLM Run CLI where a VLM Run-specific parameter, 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. 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly addresses the compatibility issue with the OpenAI client by passing the session_id through extra_body. The introduction of the _completion_create_kwargs helper function is a good refactoring that improves code clarity. The changes to support a separate default URL for the agent API are also appropriate. I've included one high-severity comment to address a bug in vlmrun/cli/cli.py where configuration from the config file is not being correctly applied, which could lead to incorrect behavior for users relying on configured settings.
| # Chat subcommand uses the Agent API; use agent base URL when none set | ||
| client_base_url = base_url | ||
| if ctx.invoked_subcommand == "chat" and client_base_url is None: | ||
| client_base_url = DEFAULT_AGENT_BASE_URL | ||
| ctx.obj = VLMRun(api_key=api_key, base_url=client_base_url) |
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.
The current logic for determining client_base_url doesn't account for the base_url that might be set in the user's config file. The base_url variable from typer.Option will be None if not provided via the CLI or an environment variable. This causes the logic to fall back to DEFAULT_AGENT_BASE_URL for the chat command, even if a custom URL is specified in the configuration file.
This also relates to a pre-existing issue where the api_key from the config file isn't passed to the VLMRun client. I suggest resolving both api_key and base_url from the config file before initializing the client to ensure consistent and predictable behavior.
| # Chat subcommand uses the Agent API; use agent base URL when none set | |
| client_base_url = base_url | |
| if ctx.invoked_subcommand == "chat" and client_base_url is None: | |
| client_base_url = DEFAULT_AGENT_BASE_URL | |
| ctx.obj = VLMRun(api_key=api_key, base_url=client_base_url) | |
| # Chat subcommand uses the Agent API; use agent base URL when none set | |
| config = get_config() | |
| resolved_api_key = api_key or config.api_key | |
| client_base_url = base_url or config.base_url | |
| if ctx.invoked_subcommand == "chat" and client_base_url is None: | |
| client_base_url = DEFAULT_AGENT_BASE_URL | |
| ctx.obj = VLMRun(api_key=resolved_api_key, base_url=client_base_url) |
Issue:
The CLI passes session_id to client.agent.completions.create(), but the OpenAI Python client doesn't accept session_id (it's a VLM Run–specific parameter).
Changes:
In _cli/chat.py, fixing to send session_id via extra_body when present. Adding a helper to pass session_id via extra_body. The OpenAI client accepts extra_body and merges it into the request body, so the VLM Run backend still receives session_id.
Before

After

