Skip to content

fix(client): keep OPENAI_* env config off Interfaze requests - #17

Open
Abhishek-B-R wants to merge 2 commits into
InterfazeAI:mainfrom
Abhishek-B-R:fix/openai-env-headers
Open

Abhishek-B-R wants to merge 2 commits into
InterfazeAI:mainfrom
Abhishek-B-R:fix/openai-env-headers

Conversation

@Abhishek-B-R

Copy link
Copy Markdown

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant