edited bigmessage
Browse files- core/types.py +12 -5
core/types.py
CHANGED
@@ -8,10 +8,10 @@ from textwrap import dedent
|
|
8 |
class ThoughtSteps(BaseModel):
|
9 |
step_title: str = Field(..., description="steps to use for the problem/question")
|
10 |
thought: str = Field(..., description="internal monologue, this contails your questions and its answers")
|
11 |
-
next_step: bool = Field(
|
12 |
answer: str | None = Field(..., description="generate a answer based on inner thoughts")
|
13 |
critic: str | None = Field(..., description="criticize the answer, try to prove it wrong , have a different perspective, fight it")
|
14 |
-
is_final_answer: bool = Field(
|
15 |
|
16 |
def to_thought_steps_display(self):
|
17 |
return ThoughtStepsDisplay(
|
@@ -44,13 +44,20 @@ class ThoughtStepsDisplay(BaseModel):
|
|
44 |
|
45 |
class BigMessage(BaseModel):
|
46 |
role:str
|
47 |
-
content:
|
48 |
-
thoughts:list[
|
49 |
|
50 |
def to_message(self):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
return {
|
52 |
"role": self.role,
|
53 |
-
"content":
|
54 |
}
|
55 |
|
56 |
class Message(BaseModel):
|
|
|
8 |
class ThoughtSteps(BaseModel):
|
9 |
step_title: str = Field(..., description="steps to use for the problem/question")
|
10 |
thought: str = Field(..., description="internal monologue, this contails your questions and its answers")
|
11 |
+
next_step: bool = Field(default=True, description="Does the problem require more thinking? if yes then set to true, else set to false,")
|
12 |
answer: str | None = Field(..., description="generate a answer based on inner thoughts")
|
13 |
critic: str | None = Field(..., description="criticize the answer, try to prove it wrong , have a different perspective, fight it")
|
14 |
+
is_final_answer: bool = Field(default=False, description="this is final answer no next step required,")
|
15 |
|
16 |
def to_thought_steps_display(self):
|
17 |
return ThoughtStepsDisplay(
|
|
|
44 |
|
45 |
class BigMessage(BaseModel):
|
46 |
role:str
|
47 |
+
content:ThoughtStepsDisplay | str
|
48 |
+
thoughts:list[ThoughtStepsDisplay|None]|None = Field(default_factory=list)
|
49 |
|
50 |
def to_message(self):
|
51 |
+
if isinstance(self.content, ThoughtStepsDisplay):
|
52 |
+
content = self.content.model_dump()
|
53 |
+
content = ThoughtSteps(**content).model_dump_json()
|
54 |
+
|
55 |
+
else:
|
56 |
+
content = self.content
|
57 |
+
|
58 |
return {
|
59 |
"role": self.role,
|
60 |
+
"content": content,
|
61 |
}
|
62 |
|
63 |
class Message(BaseModel):
|