sarim commited on
Commit
2afa0ec
·
1 Parent(s): ee1e726

limit string length

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -13,6 +13,10 @@ data = []
13
 
14
  model = GroqModel('llama-3.1-70b-versatile', api_key = api_key)
15
 
 
 
 
 
16
  async def ppt_content(data):
17
  agent = Agent(model,system_prompt=(
18
  "You are an expert in making power-point perssentation",
@@ -24,8 +28,11 @@ async def ppt_content(data):
24
  "Conclusion Slide: State the overall conclusion.",
25
  "Reference Slide: Include all citations used."
26
  ))
27
- result_1 = agent.run_sync(user_prompt="".join(data))
28
- print(result_1.data)
 
 
 
29
 
30
  def ai_ppt(data):
31
  asyncio.run(ppt_content(data=data))
 
13
 
14
  model = GroqModel('llama-3.1-70b-versatile', api_key = api_key)
15
 
16
+ def split_long_string(long_string, chunk_size=6000):
17
+ return [long_string[i:i+chunk_size] for i in range(0, len(long_string), chunk_size)]
18
+
19
+
20
  async def ppt_content(data):
21
  agent = Agent(model,system_prompt=(
22
  "You are an expert in making power-point perssentation",
 
28
  "Conclusion Slide: State the overall conclusion.",
29
  "Reference Slide: Include all citations used."
30
  ))
31
+ listOfString = split_long_string("".join(data))
32
+
33
+ result_1 = agent.run_sync(user_prompt = listOfString[0])
34
+ result_2 = agent.run_sync(user_prompt = listOfString[1],message_history=result_1.new_messages())
35
+ print(result_2.data)
36
 
37
  def ai_ppt(data):
38
  asyncio.run(ppt_content(data=data))