<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Langchain + Databricks SQL + Dolly in Machine Learning</title>
    <link>https://community.databricks.com/t5/machine-learning/langchain-databricks-sql-dolly/m-p/35873#M1862</link>
    <description>&lt;P&gt;Ok&lt;/P&gt;</description>
    <pubDate>Wed, 28 Jun 2023 21:15:29 GMT</pubDate>
    <dc:creator>Jbh</dc:creator>
    <dc:date>2023-06-28T21:15:29Z</dc:date>
    <item>
      <title>Langchain + Databricks SQL + Dolly</title>
      <link>https://community.databricks.com/t5/machine-learning/langchain-databricks-sql-dolly/m-p/4802#M217</link>
      <description>&lt;P&gt;Hi there, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;referring to this LangChain document here: &lt;A href="https://python.langchain.com/en/latest/modules/agents/toolkits/examples/sql_database.html" alt="https://python.langchain.com/en/latest/modules/agents/toolkits/examples/sql_database.html" target="_blank"&gt;SQL Database Agent — 🦜&lt;span class="lia-unicode-emoji" title=":link:"&gt;🔗&lt;/span&gt; LangChain 0.0.157&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is it possible to use LangChain’s SQL Database Agent with Databricks SQL and Dolly?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If so, could someone kindly advise what the Python syntax would be?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;db = SQLDatabase.from_uri(.....)&lt;/P&gt;&lt;P&gt;agent_executor = dolly&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wes&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 07:18:49 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/langchain-databricks-sql-dolly/m-p/4802#M217</guid>
      <dc:creator>ws-kp</dc:creator>
      <dc:date>2023-05-05T07:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: Langchain + Databricks SQL + Dolly</title>
      <link>https://community.databricks.com/t5/machine-learning/langchain-databricks-sql-dolly/m-p/4803#M218</link>
      <description>&lt;P&gt;@Wesley Shen​&amp;nbsp;:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it seems like LangChain's SQL Database Agent is designed to work with any SQL database that supports JDBC connections, which includes Databricks SQL. However, it's unclear whether it works with Dolly as Dolly is not mentioned in the documentation.&lt;/P&gt;&lt;P&gt;Assuming that LangChain's SQL Database Agent works with Databricks SQL, you can use the following Python code to create an instance of SQLDatabase from the URI of your Databricks SQL endpoint:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;from langchain_sql_database_agent.sql_database import SQLDatabase
&amp;nbsp;
# replace &amp;lt;your-databricks-sql-uri&amp;gt; with the URI of your Databricks SQL endpoint
databricks_sql_uri = "&amp;lt;your-databricks-sql-uri&amp;gt;"
&amp;nbsp;
db = SQLDatabase.from_uri(databricks_sql_uri)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Once you have created an instance of SQLDatabase, you can use it to create an instance of  SQLAgentExecutor to execute SQL queries against your Databricks SQL database. Here is an example:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;from langchain_sql_database_agent.sql_agent_executor import SQLAgentExecutor
&amp;nbsp;
# create an instance of SQLAgentExecutor using the SQLDatabase instance created earlier
agent_executor = SQLAgentExecutor(db)
&amp;nbsp;
# execute a SQL query
result = agent_executor.execute_query("SELECT * FROM my_table")
&amp;nbsp;
# process the result
for row in result:
    print(row)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Note that the exact syntax may depend on the version of LangChain's SQL Database Agent you are using, as well as any specific configuration options you need to set for your Databricks SQL endpoint.&lt;/P&gt;</description>
      <pubDate>Sat, 13 May 2023 15:33:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/langchain-databricks-sql-dolly/m-p/4803#M218</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-05-13T15:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: Langchain + Databricks SQL + Dolly</title>
      <link>https://community.databricks.com/t5/machine-learning/langchain-databricks-sql-dolly/m-p/4804#M219</link>
      <description>&lt;P&gt;thanks @Suteja Kanuri​&amp;nbsp;, but what I'm wanting to know is the how to populate the parameters specific to Databricks e.g. what would be the syntax for &amp;lt;your-databricks-sql-uri&amp;gt; be in this case?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sun, 14 May 2023 20:42:18 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/langchain-databricks-sql-dolly/m-p/4804#M219</guid>
      <dc:creator>ws-kp</dc:creator>
      <dc:date>2023-05-14T20:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: Langchain + Databricks SQL + Dolly</title>
      <link>https://community.databricks.com/t5/machine-learning/langchain-databricks-sql-dolly/m-p/4805#M220</link>
      <description>&lt;P&gt;I had to pip install sqlalchemy-databricks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;from langchain import SQLDatabase
from sqlalchemy.engine import URL
&amp;nbsp;
TOKEN = "MY-TOKEN"
HOST = "your cloud host .net/.com" # The url for the host
PORT = 443 # your port
DB = "your DB"
CATALOG = "hive_metastore" # The default catalog, can change depending of your configuration
HTTP_PATH = "/sql/1.0/xxxxxxxxxxx"
&amp;nbsp;
&amp;nbsp;
URI = URL.create(
    "databricks",
    username="token",
    password=TOKEN,
    host=HOST,
    port=PORT,
    database=DB,
    query={
        "http_path": HTTP_PATH,
        "catalog": CATALOG,
        "schema": DB
    }
)
&amp;nbsp;
db = SQLDatabase.from_uri(URI)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Help from &lt;A href="https://www.andrewvillazon.com/connect-databricks-sqlalchemy/" target="test_blank"&gt;https://www.andrewvillazon.com/connect-databricks-sqlalchemy/&lt;/A&gt; and &lt;A href="https://github.com/hwchase17/langchain/issues/2277" target="test_blank"&gt;https://github.com/hwchase17/langchain/issues/2277&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 13:43:49 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/langchain-databricks-sql-dolly/m-p/4805#M220</guid>
      <dc:creator>Etyr</dc:creator>
      <dc:date>2023-05-15T13:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: Langchain + Databricks SQL + Dolly</title>
      <link>https://community.databricks.com/t5/machine-learning/langchain-databricks-sql-dolly/m-p/4806#M221</link>
      <description>&lt;P&gt;Hi @Wesley Shen​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope all is well! Just wanted to check in if you were able to resolve your issue and would you be happy to share the solution or mark an answer as best? Else please let us know if you need more help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We'd love to hear from you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2023 08:11:04 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/langchain-databricks-sql-dolly/m-p/4806#M221</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-05-19T08:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: Langchain + Databricks SQL + Dolly</title>
      <link>https://community.databricks.com/t5/machine-learning/langchain-databricks-sql-dolly/m-p/4807#M222</link>
      <description>&lt;P&gt;Hi @Vidula Khanna​&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, a resolution has not been provided, so I can mark an answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Wes&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2023 20:45:36 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/langchain-databricks-sql-dolly/m-p/4807#M222</guid>
      <dc:creator>ws-kp</dc:creator>
      <dc:date>2023-05-23T20:45:36Z</dc:date>
    </item>
    <item>
      <title>Re: Langchain + Databricks SQL + Dolly</title>
      <link>https://community.databricks.com/t5/machine-learning/langchain-databricks-sql-dolly/m-p/4808#M223</link>
      <description>&lt;P&gt;Hi @Antoine Tavernier​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nice work for trying this. I came across this too and tried it myself with no success.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2023 20:46:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/langchain-databricks-sql-dolly/m-p/4808#M223</guid>
      <dc:creator>ws-kp</dc:creator>
      <dc:date>2023-05-23T20:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: Langchain + Databricks SQL + Dolly</title>
      <link>https://community.databricks.com/t5/machine-learning/langchain-databricks-sql-dolly/m-p/4809#M224</link>
      <description>&lt;P&gt;@Wesley Shen​&amp;nbsp;What is you error? We cannot help you with out any error messages.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It can come from a typo in your settings, a expired token, your firewall not giving you access to your cluster. There are a lot of issues possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also try to use the Spark SQL Agent (recently added in langchain), directly inside a databricks notebook.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://python.langchain.com/en/latest/modules/agents/toolkits/examples/spark_sql.html" alt="https://python.langchain.com/en/latest/modules/agents/toolkits/examples/spark_sql.html" target="_blank"&gt;https://python.langchain.com/en/latest/modules/agents/toolkits/examples/spark_sql.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2023 08:25:37 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/langchain-databricks-sql-dolly/m-p/4809#M224</guid>
      <dc:creator>Etyr</dc:creator>
      <dc:date>2023-05-24T08:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: Langchain + Databricks SQL + Dolly</title>
      <link>https://community.databricks.com/t5/machine-learning/langchain-databricks-sql-dolly/m-p/4810#M225</link>
      <description>&lt;P&gt;This pattern works for me: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;from sqlalchemy.engine import create_engine
from langchain import SQLDatabase, SQLDatabaseChain
&amp;nbsp;
engine = create_engine(
  "databricks+connector://token:dapi...@....cloud.databricks.com:443/default",
  connect_args={"http_path": "/sql/1.0/warehouses/...",})
&amp;nbsp;
db = SQLDatabase(engine, schema="default", include_tables=["nyc_taxi"])&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2023 18:45:58 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/langchain-databricks-sql-dolly/m-p/4810#M225</guid>
      <dc:creator>sean_owen</dc:creator>
      <dc:date>2023-06-02T18:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: Langchain + Databricks SQL + Dolly</title>
      <link>https://community.databricks.com/t5/machine-learning/langchain-databricks-sql-dolly/m-p/4811#M226</link>
      <description>&lt;P&gt;Dolly works fine with SQLChain. There is no need to support specific models from Hugging Face, as any model on HF can be plugged in. Load any pipeline and ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;from langchain.llms import HuggingFacePipeline
&amp;nbsp;
hf_pipeline = HuggingFacePipeline(pipeline=pipe)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2023 18:46:50 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/langchain-databricks-sql-dolly/m-p/4811#M226</guid>
      <dc:creator>sean_owen</dc:creator>
      <dc:date>2023-06-02T18:46:50Z</dc:date>
    </item>
    <item>
      <title>Re: Langchain + Databricks SQL + Dolly</title>
      <link>https://community.databricks.com/t5/machine-learning/langchain-databricks-sql-dolly/m-p/35873#M1862</link>
      <description>&lt;P&gt;Ok&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2023 21:15:29 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/langchain-databricks-sql-dolly/m-p/35873#M1862</guid>
      <dc:creator>Jbh</dc:creator>
      <dc:date>2023-06-28T21:15:29Z</dc:date>
    </item>
  </channel>
</rss>

