Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -9,19 +9,13 @@ from langchain.agents import AgentExecutor, create_openai_functions_agent
|
|
9 |
from langchain.prompts import ChatPromptTemplate, MessagesPlaceholder
|
10 |
from langchain_core.messages import AIMessage, HumanMessage
|
11 |
from langchain.tools import StructuredTool
|
12 |
-
|
13 |
-
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
14 |
-
|
15 |
-
def response_text(openai_resp):
|
16 |
-
return openai_resp['choices'][0]['message']['content']
|
17 |
-
|
18 |
from gptcache import cache
|
19 |
-
from gptcache.adapter import
|
20 |
from gptcache.embedding import Onnx
|
21 |
from gptcache.manager import CacheBase, VectorBase, get_data_manager
|
22 |
from gptcache.similarity_evaluation.distance import SearchDistanceEvaluation
|
23 |
|
24 |
-
|
25 |
|
26 |
onnx = Onnx()
|
27 |
data_manager = get_data_manager(CacheBase("sqlite"), VectorBase("faiss", dimension=onnx.dimension))
|
@@ -90,8 +84,8 @@ class GetEmployees(BaseModel):
|
|
90 |
start_time: str = Field(..., description="Required start time")
|
91 |
duration_hours: int = Field(..., description="Required duration of the availability in hours")
|
92 |
|
93 |
-
llm = ChatOpenAI(temperature=1.0, model_name="gpt-3.5-turbo", openai_api_key=OPENAI_API_KEY)
|
94 |
-
|
95 |
|
96 |
tools = [
|
97 |
StructuredTool.from_function(
|
|
|
9 |
from langchain.prompts import ChatPromptTemplate, MessagesPlaceholder
|
10 |
from langchain_core.messages import AIMessage, HumanMessage
|
11 |
from langchain.tools import StructuredTool
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
from gptcache import cache
|
13 |
+
from gptcache.adapter.langchain_models import LangChainLLMs
|
14 |
from gptcache.embedding import Onnx
|
15 |
from gptcache.manager import CacheBase, VectorBase, get_data_manager
|
16 |
from gptcache.similarity_evaluation.distance import SearchDistanceEvaluation
|
17 |
|
18 |
+
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
19 |
|
20 |
onnx = Onnx()
|
21 |
data_manager = get_data_manager(CacheBase("sqlite"), VectorBase("faiss", dimension=onnx.dimension))
|
|
|
84 |
start_time: str = Field(..., description="Required start time")
|
85 |
duration_hours: int = Field(..., description="Required duration of the availability in hours")
|
86 |
|
87 |
+
# llm = ChatOpenAI(temperature=1.0, model_name="gpt-3.5-turbo", openai_api_key=OPENAI_API_KEY)
|
88 |
+
llm = LangChainLLMs(llm=ChatOpenAI(temperature=1.0, model_name="gpt-3.5-turbo", openai_api_key=OPENAI_API_KEY))
|
89 |
|
90 |
tools = [
|
91 |
StructuredTool.from_function(
|