Closed theMK2k closed 9 months ago
You can use a custom api configuration:
const api = new OpenAIApiConfiguration({
apiKey: "my-api-key", // optional; default: process.env.OPENAI_API_KEY
// ...
});
const model = new OpenAIChatModel({
api,
// ...
});
See https://modelfusion.dev/integration/model-provider/openai#configuration for more options (e.g. Azure)
Thanks @lgrammel :)
Hi,
how do I pass in an OpenAI API key when not using environment variables?
I'm trying to get the "chat with pdf" example to work without the enviroment variable and it gives an error when running
upsertIntoVectorIndex
.snippet of my code: