fix(client): keep OPENAI_* env config off Interfaze requests - #17
Open
Abhishek-B-R wants to merge 2 commits into
Open
Abhishek-B-R wants to merge 2 commits into
Abhishek-B-R wants to merge 2 commits into
Conversation
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.
the client leaves organization and project unset, so the openai SDK reads OPENAI_ORG_ID and OPENAI_PROJECT_ID and sends them to api.interfaze.ai as OpenAI-Organization / OpenAI-Project. it also merges OPENAI_CUSTOM_HEADERS into every request, which is where people usually keep gateway auth. anyone switching an existing OpenAI app over to Interfaze is likely to have some of these set.
org and project now default to null (explicit values still win), and header names from OPENAI_CUSTOM_HEADERS are nulled out in defaultHeaders, which the openai client treats as remove.
second commit: defaultHeaders is typed HeadersLike, but it was spread into an object, so a Headers instance or an array of tuples silently lost every header. it's normalised to a record first now, same as the langchain package already does.
tests cover both with a mocked fetch; the new ones fail on main and all 135 pass with the fix. tsc, prettier, build, publint and attw are clean.
the python SDK and langchain-interfaze have the same org/project leak. sending the python one separately, happy to do langchain too.