Spaces:
Sleeping
Sleeping
thoristhor
commited on
Commit
•
5208eb9
1
Parent(s):
360e7d2
Update app.py
Browse files
app.py
CHANGED
@@ -13,19 +13,11 @@ PINECONE_API_KEY=os.environ["PINECONE_API_KEY"]
|
|
13 |
pinecone.init(api_key=PINECONE_API_KEY, environment="us-east1-gcp")
|
14 |
|
15 |
pindex=pinecone.Index("sethgodin")
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
func=lambda q: str(pinedex.query(q)),
|
22 |
-
description="useful for when you want to answer questions about the author. The input to this tool should be a complete english sentence.",
|
23 |
-
return_direct=True
|
24 |
-
),
|
25 |
-
]
|
26 |
-
memory = ConversationBufferMemory(memory_key="chat_history")
|
27 |
-
llm=OpenAI(temperature=0.6)
|
28 |
-
agent_chain = initialize_agent(tools, llm, agent="conversational-react-description", memory=memory)
|
29 |
|
30 |
def predict(input, history=[]):
|
31 |
response = agent_chain.run(input)
|
|
|
13 |
pinecone.init(api_key=PINECONE_API_KEY, environment="us-east1-gcp")
|
14 |
|
15 |
pindex=pinecone.Index("sethgodin")
|
16 |
+
indexed_pinecone=GPTPineconeIndex([], pinecone_index=pindex)
|
17 |
+
|
18 |
+
memory = GPTIndexMemory(index=pinedex, memory_key="chat_history", query_kwargs={"response_mode": "compact"})
|
19 |
+
llm=OpenAI(temperature=0)
|
20 |
+
agent_chain = initialize_agent([], llm, agent="conversational-react-description", memory=memory)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
def predict(input, history=[]):
|
23 |
response = agent_chain.run(input)
|