Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -9,17 +9,6 @@ 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 |
-
# cache
|
13 |
-
from gptcache import cache
|
14 |
-
from gptcache.adapter.langchain_models import LangChainChat
|
15 |
-
|
16 |
-
def get_msg(data, **_):
|
17 |
-
return data.get("messages")[-1].content
|
18 |
-
|
19 |
-
|
20 |
-
cache.init(
|
21 |
-
pre_embedding_func=get_msg,
|
22 |
-
)
|
23 |
|
24 |
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
25 |
|
@@ -81,8 +70,7 @@ class GetEmployees(BaseModel):
|
|
81 |
start_time: str = Field(..., description="Required start time")
|
82 |
duration_hours: int = Field(..., description="Required duration of the availability in hours")
|
83 |
|
84 |
-
|
85 |
-
llm = LangChainChat(llm=ChatOpenAI(temperature=1.0, model_name="gpt-3.5-turbo", openai_api_key=OPENAI_API_KEY))
|
86 |
|
87 |
tools = [
|
88 |
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 |
|
13 |
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
14 |
|
|
|
70 |
start_time: str = Field(..., description="Required start time")
|
71 |
duration_hours: int = Field(..., description="Required duration of the availability in hours")
|
72 |
|
73 |
+
llm = ChatOpenAI(temperature=1.0, model_name="gpt-3.5-turbo", openai_api_key=OPENAI_API_KEY)
|
|
|
74 |
|
75 |
tools = [
|
76 |
StructuredTool.from_function(
|