This commit is contained in:
Harrison Chase 2023-04-14 07:55:12 -07:00 committed by GitHub
parent 0a38bbc750
commit 8fef69296d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 13 deletions

View File

@ -1,7 +1,6 @@
{ {
"cells": [ "cells": [
{ {
"attachments": {},
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
@ -11,7 +10,6 @@
] ]
}, },
{ {
"attachments": {},
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
@ -38,7 +36,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"from langchain.document_loaders.git import GitLoader" "from langchain.document_loaders import GitLoader"
] ]
}, },
{ {
@ -109,7 +107,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"from langchain.document_loaders.git import GitLoader" "from langchain.document_loaders import GitLoader"
] ]
}, },
{ {
@ -164,7 +162,7 @@
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "ai", "display_name": "Python 3 (ipykernel)",
"language": "python", "language": "python",
"name": "python3" "name": "python3"
}, },
@ -178,9 +176,8 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.9.6" "version": "3.9.1"
}, }
"orig_nbformat": 4
}, },
"nbformat": 4, "nbformat": 4,
"nbformat_minor": 2 "nbformat_minor": 2

View File

@ -65,11 +65,7 @@ class SQLDatabaseChain(Chain):
return [self.output_key, "intermediate_steps"] return [self.output_key, "intermediate_steps"]
def _call(self, inputs: Dict[str, Any]) -> Dict[str, Any]: def _call(self, inputs: Dict[str, Any]) -> Dict[str, Any]:
try: prompt = self.prompt or SQL_PROMPTS.get(self.database.dialect, PROMPT)
prompt = self.prompt or SQL_PROMPTS[self.database.dialect]
except KeyError:
# fallback to generic prompt if dialect-specific prompt doesn't exist yet
prompt = PROMPT
llm_chain = LLMChain(llm=self.llm, prompt=prompt) llm_chain = LLMChain(llm=self.llm, prompt=prompt)
input_text = f"{inputs[self.input_key]}\nSQLQuery:" input_text = f"{inputs[self.input_key]}\nSQLQuery:"
self.callback_manager.on_text(input_text, verbose=self.verbose) self.callback_manager.on_text(input_text, verbose=self.verbose)

View File

@ -27,6 +27,7 @@ from langchain.document_loaders.evernote import EverNoteLoader
from langchain.document_loaders.facebook_chat import FacebookChatLoader from langchain.document_loaders.facebook_chat import FacebookChatLoader
from langchain.document_loaders.gcs_directory import GCSDirectoryLoader from langchain.document_loaders.gcs_directory import GCSDirectoryLoader
from langchain.document_loaders.gcs_file import GCSFileLoader from langchain.document_loaders.gcs_file import GCSFileLoader
from langchain.document_loaders.git import GitLoader
from langchain.document_loaders.gitbook import GitbookLoader from langchain.document_loaders.gitbook import GitbookLoader
from langchain.document_loaders.googledrive import GoogleDriveLoader from langchain.document_loaders.googledrive import GoogleDriveLoader
from langchain.document_loaders.gutenberg import GutenbergLoader from langchain.document_loaders.gutenberg import GutenbergLoader
@ -142,4 +143,5 @@ __all__ = [
"BigQueryLoader", "BigQueryLoader",
"BiliBiliLoader", "BiliBiliLoader",
"SlackDirectoryLoader", "SlackDirectoryLoader",
"GitLoader",
] ]