guardrails-ai / guardrails

Adding guardrails to large language models.
https://www.guardrailsai.com/docs
Apache License 2.0
4.07k stars 310 forks source link

[bug] Support passing in `api_key` from kwargs #265

Closed ShreyaR closed 1 year ago

ShreyaR commented 1 year ago

Describe the bug Currently, Guardrails assumes API key is configured from environment variables. Additionally, users should be able to pass in API keys from kwargs. As an example:

guard.parse(
    llm_api=openai.ChatCompletion.create,
    api_key=my_api_key,
    api_base=my_api_base,
    model=my_model,
    temperature=my_temperature,
    ...
)
CalebCourier commented 1 year ago

Addressed in https://github.com/ShreyaR/guardrails/pull/266

See PR description on future improvements.