Spaces:
Running
Running
update model
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import asyncio
|
|
|
|
| 2 |
from pydantic_ai.result import ResultData, RunResult
|
| 3 |
import streamlit as st
|
| 4 |
from pydantic_ai import Agent,RunContext, Tool
|
|
@@ -22,7 +23,7 @@ result_data:list[customClass.PPT] = []
|
|
| 22 |
|
| 23 |
|
| 24 |
# to generate ppt
|
| 25 |
-
model = GroqModel(
|
| 26 |
|
| 27 |
|
| 28 |
# to summarize
|
|
@@ -86,9 +87,16 @@ async def ppt_content(data):
|
|
| 86 |
message_history: list[ModelMessage] = []
|
| 87 |
# for i, chunk in enumerate(listOfString):
|
| 88 |
# print(f"Chunk {i}:\n{chunk}\n")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
|
| 91 |
-
result = agent.run_sync(user_prompt = f"Create me a powerpoint presentation
|
| 92 |
message_history = message_history,
|
| 93 |
|
| 94 |
)
|
|
|
|
| 1 |
import asyncio
|
| 2 |
+
import re
|
| 3 |
from pydantic_ai.result import ResultData, RunResult
|
| 4 |
import streamlit as st
|
| 5 |
from pydantic_ai import Agent,RunContext, Tool
|
|
|
|
| 23 |
|
| 24 |
|
| 25 |
# to generate ppt
|
| 26 |
+
model = GroqModel("llama3-groq-70b-8192-tool-use-preview", api_key = api_key)
|
| 27 |
|
| 28 |
|
| 29 |
# to summarize
|
|
|
|
| 87 |
message_history: list[ModelMessage] = []
|
| 88 |
# for i, chunk in enumerate(listOfString):
|
| 89 |
# print(f"Chunk {i}:\n{chunk}\n")
|
| 90 |
+
@agent.tool
|
| 91 |
+
async def agentTooled(ctx: RunContext)-> str:
|
| 92 |
+
"""
|
| 93 |
+
This is all the text from a pdf file that user has uploaded
|
| 94 |
+
|
| 95 |
+
"""
|
| 96 |
+
return listOfString[0] + listOfString[1] + listOfString[2]
|
| 97 |
|
| 98 |
|
| 99 |
+
result = agent.run_sync(user_prompt = f"Create me a powerpoint presentation from 'agentTooled' return value",
|
| 100 |
message_history = message_history,
|
| 101 |
|
| 102 |
)
|