Skip to content

Commit 627d660

Browse files
authored
Merge pull request #29 from GilesStrong/chore/model_bump
Chore/model bump
2 parents 39f6278 + b370dcf commit 627d660

8 files changed

Lines changed: 275 additions & 234 deletions

File tree

app/appai/services/agents/deck_constructor.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
- Is the card affordable in terms of mana cost and mana colors that the deck can produce? If not, is it worth adjusting the mana base to accommodate the card, or should it be avoided in favor of a more affordable option?
105105
- Consider the balance of the deck, including the mana curve, the mix of card types, and the overall consistency of the deck.
106106
- Do not assume names of specific cards, beyond basic lands. The legal sets are constantly changing, so you cannot rely on prior knowledge of specific cards being available.
107+
- When starting off, try to launch multiple searches for cards that will cover different aspects of the deck's strategy. By running searches in parallel, you can save time for the user.
107108
108109
## General flow:
109110
Remember, a deck must have at least 60 cards, and no more than 4 copies of any individual card (other than basic lands).
@@ -194,6 +195,7 @@ async def run_deck_constructor_agent(
194195
agent = Agent(
195196
system_prompt=DECK_CONSTRUCTION_SYSTEM_PROMPT,
196197
model=TOOL_MODEL_THINKING,
198+
model_settings={'thinking': 'high'},
197199
deps_type=DeckBuildingDeps,
198200
tools=[
199201
subagent_memory_search,
@@ -358,6 +360,7 @@ async def run_card_classifier_agent(deck_id: UUID, deck_description: str) -> Non
358360
agent = Agent(
359361
system_prompt=CARD_CLASSIFIER_SYSTEM_PROMPT,
360362
model=TOOL_MODEL_BASIC,
363+
model_settings={'thinking': False},
361364
tools=[],
362365
instrument=True,
363366
retries=0,
@@ -448,6 +451,7 @@ async def run_card_replacement_agent(
448451
agent = Agent(
449452
system_prompt=CARD_REPLACEMENT_SYSTEM_PROMPT,
450453
model=TOOL_MODEL_BASIC,
454+
model_settings={'thinking': False},
451455
tools=[],
452456
instrument=True,
453457
retries=0,

app/appai/services/agents/deck_theme.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def get_daily_deck_theme() -> NewTheme:
8080
agent = Agent(
8181
model=TOOL_MODEL_BASIC,
8282
system_prompt=DECK_THEME_PROMPT,
83+
model_settings={'thinking': False},
8384
instrument=True,
8485
output_type=NewTheme,
8586
tools=[find_similar_themes],

app/appai/services/agents/filter_constructor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ async def filter_constructor(query: str) -> Filter:
220220
agent = Agent(
221221
model=TOOL_MODEL_BASIC,
222222
system_prompt=FILTER_CONSTRUCTION_PROMPT,
223+
model_settings={'thinking': False},
223224
output_retries=10,
224225
output_type=Filter,
225226
instrument=True,

app/appai/services/agents/guardrails.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ def guardrail_agent(user_request: str, context: str) -> RelevancyScore:
8787

8888
agent = Agent(
8989
model=TEXT_MODEL,
90+
model_settings={'thinking': False},
9091
system_prompt=get_guardrail_system_prompt(context),
9192
output_retries=5,
9293
output_type=RelevancyScore,

app/appai/services/agents/tools/memory_tools.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ async def write_memory(ctx: RunContext[DeckBuildingDeps], content: str, related_
133133
None: This tool does not return any output, it simply records the memory for future reference.
134134
"""
135135
if len(related_card_uuids) > 10:
136-
raise ValueError("A maximum of 10 related card UUIDs can be included in a memory.")
136+
logfire.warning("Memory writing tool called with too many related_card_uuids.", count=len(related_card_uuids))
137+
raise ModelRetry("A maximum of 10 related card UUIDs can be included in a memory.")
137138
if len(related_card_uuids) > 0:
138139
try:
139140
await _check_related_card_uuids(related_card_uuids)
@@ -147,7 +148,8 @@ async def write_memory(ctx: RunContext[DeckBuildingDeps], content: str, related_
147148
agent = Agent(
148149
model=TOOL_MODEL_BASIC,
149150
system_prompt=MEMORY_WRITING_AGENT_PROMPT,
150-
output_type=Memory | None, # type: ignore [arg-type]
151+
model_settings={'thinking': False},
152+
output_type=Memory | None, # type: ignore [arg-type, call-overload]
151153
retries=10,
152154
output_retries=10,
153155
instrument=True,
@@ -394,6 +396,7 @@ async def subagent_memory_search(ctx: RunContext[DeckBuildingDeps], query: str)
394396
agent = Agent(
395397
model=TOOL_MODEL_BASIC,
396398
system_prompt=MEMORY_SEARCH_PROMPT,
399+
model_settings={'thinking': False},
397400
instrument=True,
398401
tools=[semantic_memory_search, card_memory_search],
399402
output_type=MemorySummary,

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ dependencies = [
2323
"jq>=1.11.0",
2424
"tqdm>=4.67.1",
2525
"kombu>=5.6.2",
26-
"pydantic-ai>=1.58.0",
2726
"pydantic>=2.12.5",
2827
"pydantic-settings>=2.12.0",
2928
"qdrant-client>=1.16.2",
@@ -40,6 +39,7 @@ dependencies = [
4039
"authlib>=1.6.9",
4140
"langchain-core>=1.2.22",
4241
"pyasn1>=0.6.3",
42+
"pydantic-ai>=1.87.0",
4343
]
4444

4545
[dependency-groups]

0 commit comments

Comments
 (0)