Closed mtakemoto closed 3 months ago
Hey @mtakemoto! This error is from the embedding_driver
, not the prompt_driver
that you have overridden.
See the note here regarding this behavior. In your case, you can provide the AzureOpenAiEmbeddingDriver like this:
import os
from griptape.structures import Agent
from griptape.drivers import AzureOpenAiChatPromptDriver, AzureOpenAiEmbeddingDriver
agent = Agent(
prompt_driver=AzureOpenAiChatPromptDriver(
api_key=os.environ["AZURE_OPENAI_API_KEY_1"],
model="gpt-3.5-turbo-16k",
azure_deployment=os.environ["AZURE_OPENAI_35_16k_DEPLOYMENT_ID"],
azure_endpoint=os.environ["AZURE_OPENAI_API_BASE_1"],
),
embedding_driver=AzureOpenAiEmbeddingDriver(
api_key=os.environ["AZURE_OPENAI_API_KEY_1"],
model="text-embedding-ada-002",
azure_deployment=os.environ["AZURE_OPENAI_35_16k_DEPLOYMENT_ID"],
azure_endpoint=os.environ["AZURE_OPENAI_API_BASE_1"],
),
)
Hey @mtakemoto just checking in to see whether this has resolved your issue. Thanks!
Hey @collindutter thanks for the reply here showing me how to override the embedding driver! However, I'd like to propose that the AzureOpenAiChatPromptDriver
automatically initialize the associated Azure embedding driver for the following reasons:
More broadly, I'd like to propose that any cloud-based AI provider automatically initialize with their own embedding endpoint unless explicitly overridden (e.g. wanting to mix HuggingFace models with an OpenAI embedding provider).
Thanks again and please let me know what your thoughts are!
Thank you for the well thought out suggestion, and totally agree with your points!
The topic of defaults is something we are actively working on in #242; we should have a proper solution in the coming weeks. The Prompt Driver will likely still remain decoupled from the Embedding Driver, but there will be a new construct to tie them together.
We've gotten this issue a handful of times over the last few weeks, I am going to keep this issue open as the source of discussion.
closed by #242
Describe the bug After configuring the AzureOpenAiChatPromptDriver, it won't start without also setting the "OPENAI_API_KEY" environment variable. This is a bit deceptive since (in theory) Azure OpenAI should support everything that the 1st party offering does.
To Reproduce Steps to reproduce the behavior:
api_key
,model
,azure_deployment
andazure_endpoint
Expected behavior The embedding driver should use the Azure endpoint for embeddings and not have a dependency on environment variable
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context The WebScraper also has a hard dependency on the OpenAI tokenizer. Falls into the same category of making the library more flexible but probably worth opening a separate isue