fix: proxy client init bug - #130
Open
yamaceay wants to merge 9 commits into
Open
Conversation
3 tasks
Contributor
Author
|
This check went successful after the fix: from langchain_core.prompts import PromptTemplate
from langchain_core.output_parsers import StrOutputParser
from packages.gen.gen_ai_hub.proxy.langchain import init_llm
template = """Question: {question}
Answer: Let's think step by step."""
prompt = PromptTemplate(template=template, input_variables=['question'])
question = 'What is a supernova?'
llm = init_llm('gpt-5', max_tokens=300)
chain = prompt | llm | StrOutputParser()
response = chain.invoke({'question': question}) |
alpkom
requested changes
Sep 8, 2026
alpkom
left a comment
Contributor
There was a problem hiding this comment.
Looks good to me, but let's add some tests (both unit and integration) for the use case which failed before this fix.
Contributor
Author
|
Now we have two new unit tests. Both fail in the main branch, and all tests pass in this current PR. I am not sure if we will need integration tests, because the bug is not a network or deployment issue per se, just a simple wiring issue. The unit tests should fully cover the fix. |
Co-authored-by: yamaceay <46201716+yamaceay@users.noreply.github.com>
3 tasks
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.
References
What this PR does and why it is needed
v7.2.0 introduced a new bug. Intentionally,
init_llmandinit_embedding_modelnow require the model name / id to be passed (previously it was optional). Along with that, defaultproxy_clientsetting was also mistakenly removed from the code base.If no
proxy_clientis passed through, proxy client is forwarded as None in the underlying subclass call, so that we run into the error "NoneType has no such XXX attribute / property".So the correct fix to the docs is to add:
Note: There is only one client available in the client registry, namely 'gen-ai-hub', so that the default setting will provide full coverage.
Definition of Done