Trying to import the module without OPENAI_API_KEY set throws an error.
controlflow==0.7.5
windows (yuck)
powershell (super yuck)
Ideal resolution:
not have to set an OPENAI_API_KEY environment variable if i'm not using OpenAI
Temporary Resolution:
export OPENAI_API_KEY=nonsense to make the code happy.
example script:
import os
from pydantic import BaseModel
from langchain_mycustommodel import MyCustomLLM #type: langchain LLM
llm = MyCustomLLM(**kwargs)
import controlflow as cf
cf.default_model = llm
# also tried:
author = cf.Agent(
model=llm,
name="Deep Thought",
instructions="Use a formal tone and clear language",
)
throws error:
openai/gpt-4o None
Traceback (most recent call last):
File "example\cf.py", line 5, in <module>
import controlflow as cf
File ".control\Lib\site-packages\controlflow\__init__.py", line 18, in <module>
default_model = model_from_string(controlflow.settings.llm_model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".control\Lib\site-packages\controlflow\llm\models.py", line 63, in model_from_string
return cls(model=model, temperature=temperature, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".control\Lib\site-packages\pydantic\v1\main.py", line 341, in __init__
raise validation_error
pydantic.v1.error_wrappers.ValidationError: 1 validation error for ChatOpenAI
__root__
Did not find openai_api_key, please add an environment variable `OPENAI_API_KEY` which contains it, or pass `openai_api_key` as a named parameter. (type=value_error)
Trying to import the module without OPENAI_API_KEY set throws an error.
controlflow==0.7.5
windows (yuck) powershell (super yuck)
Ideal resolution:
Temporary Resolution:
export OPENAI_API_KEY=nonsense
to make the code happy.example script:
throws error:
caused by the top level import itself: https://github.com/PrefectHQ/ControlFlow/blob/main/src/controlflow/__init__.py#L18