ClientConfig should support a ProjectID
massenz opened this issue · comments
Recently OpenAI has added the support for Projects, within an Org; and Assistants are now project-scoped.
When creating a new Client, ClientConfig
should support a ProjectID
field, similar to what the Python API does:
from openai import OpenAI
client = OpenAI(
organization='org-xG5HLfr7CRdMSiSBlycUpcIw',
project='$PROJECT_ID',
)
I suspect there may be a workaround currently by adding a custom header:
-H "OpenAI-Project: $PROJECT_ID"
but this is not documented.
Is your feature request related to a problem? Please describe.
Assistants (and by induction, Threads and Messages) are Project-scoped in the OpenAI API, so not having this limits us to using only the DefaultProject
which causes issues of isolation, etc.
Describe the solution you'd like
Add a ProjectID
to the ClientConfig
struct
Describe alternatives you've considered
Custom OpenAI-Project
header
Additional context
I'd be happy to contribute the code to implement this: just say the word!
❤️ go-openai
!!!
Actually, while researching this issue, I just discovered that now OpenAI API Keys can be created "project scoped" so this is unnecessary, so long as the user selects a project-specific API key.
This largely solves the issue here, but I still think that, for the sake of parity (and because there may be use cases where a "super-user" API key may be used to manage multiple projects) it would be good to add support for a Project ID.