Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend OpenAI provider to accept Organization and Project #1067

Open
shirhatti opened this issue Feb 4, 2025 · 0 comments
Open

Extend OpenAI provider to accept Organization and Project #1067

shirhatti opened this issue Feb 4, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@shirhatti
Copy link

For users who belong to multiple organizations, OpenAI expects you to pass a header specifying which organization and project is used for an API request.

Snippet from their docs:

curl https://api.openai.com/v1/models \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Organization: YOUR_ORG_ID" \
  -H "OpenAI-Project: $PROJECT_ID"

Would you be amenable to extending the provider configuration to accept openai_organization and openai_project as new configuration keys?

@salman1993 salman1993 added the enhancement New feature or request label Feb 4, 2025
jasonkneen added a commit to jasonkneen/maverick that referenced this issue Feb 6, 2025
Fixes block#1067

Extend the OpenAI provider to accept `openai_organization` and `openai_project` as new configuration keys.

* Add `openai_organization` and `openai_project` to the `Settings` struct in `crates/goose-server/src/configuration.rs`.
* Update the `test_socket_addr_conversion` function in `crates/goose-server/src/configuration.rs` to include `openai_organization` and `openai_project`.
* Add `openai_organization` and `openai_project` to the `OpenAiProvider` struct in `crates/goose/src/providers/openai.rs`.
* Update the `from_env` function in `crates/goose/src/providers/openai.rs` to load `openai_organization` and `openai_project`.
* Modify the `post` function in `crates/goose/src/providers/openai.rs` to include `openai_organization` and `openai_project` in the request headers.
* Add `OPENAI_ORGANIZATION` and `OPENAI_PROJECT` to the configuration keys in `crates/goose/src/providers/openai.rs`.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/block/goose/issues/1067?shareId=XXXX-XXXX-XXXX-XXXX).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants