Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
from datetime import date
|
4 |
-
from langchain.agents import AgentType, initialize_agent
|
5 |
from langchain.chat_models import ChatOpenAI
|
6 |
|
7 |
config = {
|
@@ -33,12 +33,11 @@ def invoke(openai_api_key, prompt):
|
|
33 |
openai_api_key = openai_api_key,
|
34 |
temperature = config["temperature"])
|
35 |
|
36 |
-
agent = initialize_agent(
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
verbose = True)
|
42 |
|
43 |
result = agent(prompt)
|
44 |
|
@@ -60,6 +59,6 @@ demo = gr.Interface(fn = invoke,
|
|
60 |
gr.Textbox(label = "Prompt", lines = 1)],
|
61 |
outputs = [gr.Textbox(label = "Completion", lines = 1)],
|
62 |
title = "Generative AI - LLM & Agent",
|
63 |
-
description = description
|
64 |
|
65 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
from datetime import date
|
4 |
+
from langchain.agents import AgentType, initialize_agent
|
5 |
from langchain.chat_models import ChatOpenAI
|
6 |
|
7 |
config = {
|
|
|
33 |
openai_api_key = openai_api_key,
|
34 |
temperature = config["temperature"])
|
35 |
|
36 |
+
agent = initialize_agent([time],
|
37 |
+
llm,
|
38 |
+
agent = AgentType.CHAT_ZERO_SHOT_REACT_DESCRIPTION,
|
39 |
+
handle_parsing_errors = True,
|
40 |
+
verbose = True)
|
|
|
41 |
|
42 |
result = agent(prompt)
|
43 |
|
|
|
59 |
gr.Textbox(label = "Prompt", lines = 1)],
|
60 |
outputs = [gr.Textbox(label = "Completion", lines = 1)],
|
61 |
title = "Generative AI - LLM & Agent",
|
62 |
+
description = description)
|
63 |
|
64 |
demo.launch()
|