Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -64,7 +64,7 @@ def complation(history, model, system_prompt, tools=None):
|
|
64 |
def respond(
|
65 |
message:any,
|
66 |
history:any,
|
67 |
-
|
68 |
):
|
69 |
try:
|
70 |
models = client.models.list()
|
@@ -82,7 +82,7 @@ def respond(
|
|
82 |
content=message,
|
83 |
)
|
84 |
)
|
85 |
-
completion = complation(history=history, tools=oitools, model=model,
|
86 |
appended = False
|
87 |
for chunk in completion:
|
88 |
if len(chunk.choices) > 0 and chunk.choices[0].delta.tool_calls and len(chunk.choices[0].delta.tool_calls) > 0 :
|
@@ -124,7 +124,7 @@ def respond(
|
|
124 |
)
|
125 |
yield history[-1]
|
126 |
|
127 |
-
completion = complation(history=history, tools=oitools, model=model, system_prompt=
|
128 |
result = ""
|
129 |
appended = False
|
130 |
for chunk in completion:
|
@@ -147,4 +147,4 @@ For information on how to customize the ChatInterface, peruse the gradio docs: h
|
|
147 |
if __name__ == "__main__":
|
148 |
system_prompt = gr.Textbox(label="System propmt", value=SYSTEM_PROMPT_TEMPLATE, lines=3)
|
149 |
demo = gr.ChatInterface(respond, type="messages", additional_inputs=[system_prompt])
|
150 |
-
demo.launch()
|
|
|
64 |
def respond(
|
65 |
message:any,
|
66 |
history:any,
|
67 |
+
additional_inputs,
|
68 |
):
|
69 |
try:
|
70 |
models = client.models.list()
|
|
|
82 |
content=message,
|
83 |
)
|
84 |
)
|
85 |
+
completion = complation(history=history, tools=oitools, model=model, system_prompt=additional_inputs)
|
86 |
appended = False
|
87 |
for chunk in completion:
|
88 |
if len(chunk.choices) > 0 and chunk.choices[0].delta.tool_calls and len(chunk.choices[0].delta.tool_calls) > 0 :
|
|
|
124 |
)
|
125 |
yield history[-1]
|
126 |
|
127 |
+
completion = complation(history=history, tools=oitools, model=model, system_prompt=additional_inputs)
|
128 |
result = ""
|
129 |
appended = False
|
130 |
for chunk in completion:
|
|
|
147 |
if __name__ == "__main__":
|
148 |
system_prompt = gr.Textbox(label="System propmt", value=SYSTEM_PROMPT_TEMPLATE, lines=3)
|
149 |
demo = gr.ChatInterface(respond, type="messages", additional_inputs=[system_prompt])
|
150 |
+
demo.launch()
|