-
Couldn't load subscription status.
- Fork 572
Open
Description
I encountered an error while running the End-to-end example from the Azure OpenAI documentation. The error indicates that the OPENAI_API_KEY is not set .
Error Message:
Traceback (most recent call last):
File "C:\Applications\Application\autoLLM\demo.py", line 21, in <module>
world_model = WorldModel()
^^^^^^^^^^^^
File "C:\Applications\Application\autoLLM\venv\Lib\site-packages\lavague\core\world_model.py", line 377, in __init__
mm_llm = get_default_context().mm_llm
^^^^^^^^^^^^^^^^^^^^^
File "C:\Applications\Application\autoLLM\venv\Lib\site-packages\lavague\core\context.py", line 35, in get_default_context
return OpenaiContext()
^^^^^^^^^^^^^^^
File "C:\Applications\Application\autoLLM\venv\Lib\site-packages\lavague\contexts\openai\base.py", line 23, in __init__
raise ValueError("OPENAI_API_KEY is not set")
ValueError: OPENAI_API_KEY is not set
Steps to Reproduce:
- Follow the End-to-end example from the Azure OpenAI documentation.
- Fill in the required Azure configs
- Run the provided code snippet.
Code Snippet:
from lavague.core import WorldModel, ActionEngine
from lavague.core.agents import WebAgent
from lavague.drivers.selenium import SeleniumDriver
from lavague.contexts.openai import AzureOpenaiContext
# Initialize context with our custom elements
context = AzureOpenaiContext(
api_key="your_api_key",
deployment="deployment_name",
llm="<model_name>",
mm_llm="<model_name>",
endpoint="<your_endpoint>",
embedding="embedding_model_name",
embedding_deployment="embedding_deployment_name"
)
selenium_driver = SeleniumDriver()
# Build Action Engine and World Model from Context
action_engine = ActionEngine.from_context(context=context, driver=selenium_driver)
world_model = WorldModel()
# Build agent & run query
agent = WebAgent(world_model, action_engine)
agent.get("https://huggingface.co/")
agent.run("What is this week's top Space of the week?")Expected Behavior: The code should run without errors and perform the intended actions.
Actual Behavior: The code raises a ValueError indicating that the OPENAI_API_KEY is not set.
Passing the mm_llm from the context to the WorldModel when creating an instance of it fixes it.
world_model = WorldModel(mm_llm=context.mm_llm) Metadata
Metadata
Assignees
Labels
No labels