Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Python API support for passing an API key to a model #744

@simonw

Description

@simonw

For some applications it may be useful to provide API keys for models at runtime when a prompt is executed. That's not very easy right now - you can set model.key = "x" but that's then shared across all uses of that model instance. This is bad for multi-user environments like web applications, plus there's no easy way to create new model instances - llm.get_model(model_id) returns a single shared object.

I don't want to break existing code here, so I'm going to make this a new optional argument to model.prompt("prompt", key=...).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions