Conversation
…endpoint vision_analyze crashes with AttributeError when the main runtime uses a callable api_key (e.g. short-lived credential supplier) with a custom OpenAI-compatible endpoint. The auxiliary client's custom-endpoint branch calls .strip() directly on explicit_api_key without resolving callables first, while the runtime path already preserves callables. Fix both the explicit_base_url path (line 5953) and the main_runtime fallback path (line 5977) by resolving callable API keys before string operations. Fixes NousResearch#79121
|
I validated this exact head ( |
|
Withdrawing this PR — closing as part of a cleanup pass on our submitted contributions. |
|
Withdrawing this PR as part of a contribution cleanup pass. |
This branch has not been deployed
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.
Summary
vision_analyzecrashes withAttributeError: 'function' object has no attribute 'strip'when the main runtime uses a callableapi_key(short-lived credential supplier) with a custom OpenAI-compatible endpoint.Root Cause
The auxiliary client's custom-endpoint branch in
resolve_provider_client()calls.strip()directly onexplicit_api_keywithout resolving callables first. The runtime path (line 3069) already preserves callables withapi_key if callable(api_key), but the auxiliary resolution path crashes when it encounters a callable.Two code paths affected:
(explicit_api_key or "").strip()— callable is truthy, socallable or ""returns the callable, then.strip()raisesAttributeErrorstr(main_runtime.get("api_key") or "").strip()—str(callable)returns"<function ...>", which is a string but wrong as an API keyFix
Resolve callable API keys before string operations in both paths:
Test Plan
explicit_api_keywith custom endpoint resolves correctlyexplicit_api_keycontinues to work unchangedmain_runtimewith callableapi_keyresolves correctlyFixes #79121