sarim commited on
Commit
d553fab
·
1 Parent(s): 24135d0

response model

Browse files
Files changed (2) hide show
  1. app.py +5 -1
  2. presentation.py +21 -0
app.py CHANGED
@@ -6,6 +6,7 @@ from pydantic_ai.models.groq import GroqModel
6
  import nest_asyncio
7
  import pdfplumber
8
  import os
 
9
 
10
 
11
  api_key = os.getenv("API_KEY")
@@ -21,7 +22,9 @@ def split_long_string(long_string, chunk_size=6000):
21
 
22
 
23
  async def ppt_content(data):
24
- agent = Agent(model,system_prompt=(
 
 
25
  "You are an expert in making power-point perssentation",
26
  "Create 6 sliders",
27
  "Each slide should be seperate"
@@ -48,6 +51,7 @@ async def ppt_content(data):
48
  print(result_2.all_messages_json())
49
  print(result_2.new_messages_json())
50
  print(result_2.data)
 
51
 
52
  def ai_ppt(data):
53
  asyncio.run(ppt_content(data=data))
 
6
  import nest_asyncio
7
  import pdfplumber
8
  import os
9
+ import presentation as customClass
10
 
11
 
12
  api_key = os.getenv("API_KEY")
 
22
 
23
 
24
  async def ppt_content(data):
25
+ agent = Agent(model,
26
+ result_type=customClass.PPT,
27
+ system_prompt=(
28
  "You are an expert in making power-point perssentation",
29
  "Create 6 sliders",
30
  "Each slide should be seperate"
 
51
  print(result_2.all_messages_json())
52
  print(result_2.new_messages_json())
53
  print(result_2.data)
54
+ print(result_2)
55
 
56
  def ai_ppt(data):
57
  asyncio.run(ppt_content(data=data))
presentation.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pydantic import BaseModel, Field
2
+ from dataclasses import dataclass, field
3
+ from typing import List, Dict,Optional
4
+
5
+
6
+
7
+ @dataclass
8
+ class Perssentation(BaseModel):
9
+ title:str = Field(description="Title of the slide")
10
+ subTitle: Optional[str] = Field(description="Subtitle only for 1st slide")
11
+ author:Optional[str] = Field(description="Subtitle only for 1st slide")
12
+ text:str = Field(description="Detail description")
13
+ bulletPoints:Optional[list] = Field(description="Bullet Points")
14
+ imageSuggestion:Optional[str] = Field(description="Image prompt that we can give to AI image generator")
15
+
16
+
17
+
18
+
19
+ @dataclass
20
+ class PPT(BaseModel):
21
+ per:list[Perssentation]