fix: use LLM.from_url() when llm_server_url is provided#262
Open
giwaov wants to merge 1 commit intoOpenGradient:mainfrom
Open
fix: use LLM.from_url() when llm_server_url is provided#262giwaov wants to merge 1 commit intoOpenGradient:mainfrom
giwaov wants to merge 1 commit intoOpenGradient:mainfrom
Conversation
OpenGradientChatModel passed llm_server_url as a kwarg to LLM(), but LLM.__init__() does not accept that parameter, causing a TypeError at runtime. The correct API is LLM.from_url(). When llm_server_url is provided, call LLM.from_url(private_key, llm_server_url) instead of LLM(private_key, **llm_kwargs). Closes OpenGradient#248
kylexqian
approved these changes
Apr 9, 2026
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.
Problem
\OpenGradientChatModel\ in \og_langchain.py\ passes \llm_server_url\ as a keyword argument to \LLM(), but \LLM.init()\ only accepts \private_key,
pc_url, and \ ee_registry_address.
This causes a \TypeError: init() got an unexpected keyword argument 'llm_server_url'\ at runtime when a developer tries to use the \llm_server_url\ parameter through \langchain_adapter()\ or \OpenGradientChatModel().
The correct API for creating an LLM client with a hardcoded TEE endpoint is \LLM.from_url(private_key, llm_server_url).
Fix
When \llm_server_url\ is provided, call \LLM.from_url(private_key, llm_server_url)\ instead of passing it as a kwarg to \LLM(). The regular \LLM()\ constructor path is preserved for the
pc_url/\ ee_registry_address\ case.
Changes
Closes #248