ka1kuk commited on
Commit
a1505c8
1 Parent(s): 9c5860c

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +8 -6
main.py CHANGED
@@ -38,21 +38,23 @@ llm = G4F(model=model)
38
  agent_chain = initialize_agent(tools, llm, agent="chat-conversational-react-description",
39
  verbose=True, memory=memory)
40
 
41
- class messages(BaseModel):
42
- messages: str
43
 
44
  @app.get("/")
45
  def gello():
46
  return "Hello! My name is Linlada."
47
 
48
  @app.post('/linlada')
49
- def hello_post(message: messages):
50
  llm = G4F(model=model)
51
- chat = llm(message)
 
 
52
  return chat
53
 
54
  @app.post('/search')
55
- def searches(message: messages):
56
- response = agent_chain.run(input=message)
 
 
57
  return response
58
 
 
38
  agent_chain = initialize_agent(tools, llm, agent="chat-conversational-react-description",
39
  verbose=True, memory=memory)
40
 
 
 
41
 
42
  @app.get("/")
43
  def gello():
44
  return "Hello! My name is Linlada."
45
 
46
  @app.post('/linlada')
47
+ async def hello_post():
48
  llm = G4F(model=model)
49
+ data = await request.json()
50
+ prompt = data['prompt']
51
+ chat = llm(prompt)
52
  return chat
53
 
54
  @app.post('/search')
55
+ async def searches():
56
+ data = await request.json()
57
+ prompt = data['prompt']
58
+ response = agent_chain.run(input=prompt)
59
  return response
60