cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Resource Not Found

Rajaniesh
New Contributor III

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

0 REPLIES 0

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group