remove default usage of openai model in SQLDatabaseToolkit (#2884)

#2866

This toolkit used openai LLM as the default, which could incurr unwanted
cost.
This commit is contained in:
Cao Hoang 2023-04-25 06:27:38 +07:00 committed by GitHub
parent 675d86aa11
commit 26035dfa59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,7 +5,6 @@ from pydantic import Field
from langchain.agents.agent_toolkits.base import BaseToolkit
from langchain.llms.base import BaseLLM
from langchain.llms.openai import OpenAI
from langchain.sql_database import SQLDatabase
from langchain.tools import BaseTool
from langchain.tools.sql_database.tool import (
@ -20,7 +19,7 @@ class SQLDatabaseToolkit(BaseToolkit):
"""Toolkit for interacting with SQL databases."""
db: SQLDatabase = Field(exclude=True)
llm: BaseLLM = Field(default_factory=lambda: OpenAI(temperature=0))
llm: BaseLLM = Field(exclude=True)
@property
def dialect(self) -> str: