Skip to content

possible error loading environment via load_env #3

@MSDNAndi

Description

@MSDNAndi

@MSDNAndi
Description
MSDNAndi
opened 13 minutes ago
new_pipeline and possibly other entry points do not load the .env file via dotenv with load_dotenv

Symptom:

(paper2poster) erben@ErbenX370:~/dev/AI/science/papers/Paper2Poster$ python -m PosterAgent.new_pipeline --poster_path dataset/Thefutureinthemanagementofcarotidstenosis/Thefutureinthemanagementofcarotidstenosis.pdf --model_name_t="4o-mini" --model_name_v="4o-mini" --poster_width_inches=48 --
poster_height_inches=36
:128: RuntimeWarning: 'PosterAgent.new_pipeline' found in sys.modules after import of package 'PosterAgent', but prior to execution of 'PosterAgent.new_pipeline'; this may result in unpredictable behaviour
Poster size: 48.0 x 36.0 inches
/home/erben/miniconda3/envs/paper2poster/lib/python3.11/site-packages/torch/utils/cpp_extension.py:1964: UserWarning: TORCH_CUDA_ARCH_LIST is not set, all archs for visible cards are included for compilation.
If this is not desired, please set os.environ['TORCH_CUDA_ARCH_LIST'].
warnings.warn(
Traceback (most recent call last):
File "/home/erben/miniconda3/envs/paper2poster/lib/python3.11/site-packages/tenacity/init.py", line 478, in call
result = fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/home/erben/dev/AI/science/papers/Paper2Poster/PosterAgent/parse_raw.py", line 73, in parse_raw
actor_model = ModelFactory.create(
^^^^^^^^^^^^^^^^^^^^
File "/home/erben/dev/AI/science/papers/Paper2Poster/camel/models/model_factory.py", line 150, in create
return model_class(
^^^^^^^^^^^^
File "/home/erben/dev/AI/science/papers/Paper2Poster/camel/utils/commons.py", line 306, in wrapper
raise ValueError(
ValueError: Missing or empty required API keys in environment variables: OPENAI_API_KEY

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/home/erben/dev/AI/science/papers/Paper2Poster/PosterAgent/new_pipeline.py", line 98, in
input_token, output_token, raw_result = parse_raw(args, agent_config_t, version=2)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/erben/miniconda3/envs/paper2poster/lib/python3.11/site-packages/tenacity/init.py", line 336, in wrapped_f
return copy(f, *args, **kw)
^^^^^^^^^^^^^^^^^^^^
File "/home/erben/miniconda3/envs/paper2poster/lib/python3.11/site-packages/tenacity/init.py", line 475, in call
do = self.iter(retry_state=retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/erben/miniconda3/envs/paper2poster/lib/python3.11/site-packages/tenacity/init.py", line 376, in iter
result = action(retry_state)
^^^^^^^^^^^^^^^^^^^
File "/home/erben/miniconda3/envs/paper2poster/lib/python3.11/site-packages/tenacity/init.py", line 419, in exc_check
raise retry_exc from fut.exception()
tenacity.RetryError: RetryError[<Future at 0x7e3dc43482d0 state=finished raised ValueError>]
(paper2poster) erben@ErbenX370:~/dev/AI/science/papers/Paper2Poster$

Expected behavior: Every entry point should load .env
Assume .env is present in ~/dev/AI/science/papers/Paper2Poster and has entries for

tell Camel to use Azure rather than “openai”

MODEL_PLATFORM=azure
MODEL_TYPE=o4-mini

your Azure OpenAI resource endpoint

AZURE_OPENAI_ENDPOINT=https://aiearlyaccess.openai.azure.com

the name of the deployment you created in Azure

AZURE_OPENAI_DEPLOYMENT_NAME=o4-mini

the API version you want to target (must match your resource’s)

AZURE_OPENAI_API_VERSION=2024-12-01-preview

your Azure OpenAI keys

AZURE_OPENAI_API_KEY=DUMMYKEY

The actual AZURE_OPENAI_API_KEY is of course not provided. in the sample I post here.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions