Hi,
I am trying to write a simple code in databricks using langchain. But it is throwing this error: Resource not
%pip install --upgrade openai
%pip install langchain --upgrade
%pip install pymssql --upgrade
%pip install SQLAlchemy
%pip install pyodbc
import os
from langchain.llms import AzureOpenAI
import openai
from langchain.agents import create_sql_agent
from langchain.agents.agent_toolkits import SQLDatabaseToolkit
from langchain.sql_database import SQLDatabase
from langchain.llms.openai import OpenAI
from langchain.agents import AgentExecutor
import pymssql
from sqlalchemy.engine import URL
# Configure OpenAI API
os.environ["OPENAI_API_TYPE"] = "azure"
os.environ["OPENAI_API_KEY"] = "xxxxxxxx"
os.environ["OPENAI_API_BASE"] = "https://zxadw.openai.azure.com/"
os.environ["OPENAI_API_VERSION"] = "2022-12-01"
llm = AzureOpenAI(deployment_name="text-davinci-003", model_name="text-davinci-003")
db = SQLDatabase.from_uri("mssql+pymssql://sqladmin:Passw0rd@hostnameofazuresqldb:1433/AdventureWorks2017")
toolkit = SQLDatabaseToolkit(db=db, llm=llm ,use_query_checker=True, verbose=True, return_intermediate_steps=True )
agent_executor = create_sql_agent(
llm=llm,
toolkit=toolkit,
verbose=True,
db=db
)
agent_executor.run("List the tables in the database")
But it throws this error:
> Entering new AgentExecutor chain...
InvalidRequestError: Resource not found
Any clue!!
Regards
Rajaniesh