Python: [BREAKING] update to v1.0.0 (#5062)

* updates to final deprecated pieces and versions

* fix mypy

* fix readme links
This commit is contained in:
Eduard van Valkenburg
2026-04-02 17:26:30 +02:00
committed by GitHub
Unverified
parent 5f06b68535
commit 3446eb8d5d
171 changed files with 2580 additions and 2392 deletions
@@ -35,25 +35,27 @@ class BudgetSummaryClient:
**kwargs: Any,
) -> ChatResponse:
summary_text = f"Budget summary generated from {len(messages)} prompt messages."
return ChatResponse(messages=[Message(role="assistant", text=summary_text)])
return ChatResponse(messages=[Message(role="assistant", contents=[summary_text])])
def _build_long_history() -> list[Message]:
history = [Message(role="system", text="You are a migration copilot.")]
history = [Message(role="system", contents=["You are a migration copilot."])]
for i in range(1, 8):
history.append(
Message(
role="user",
text=f"Iteration {i}: capture migration requirements and edge cases.",
contents=[f"Iteration {i}: capture migration requirements and edge cases."],
)
)
history.append(
Message(
role="assistant",
text=(
f"Iteration {i}: detailed plan with dependencies, rollback guidance, and testing details. "
"This sentence is intentionally long to create token pressure."
),
contents=[
(
f"Iteration {i}: detailed plan with dependencies, rollback guidance, and testing details. "
"This sentence is intentionally long to create token pressure."
)
],
)
)
return history
@@ -57,17 +57,17 @@ class InspectingChatClient(BaseChatClient[Any]):
self.last_messages = list(messages)
async def _get_response() -> ChatResponse:
return ChatResponse(messages=[Message(role="assistant", text="done")])
return ChatResponse(messages=[Message(role="assistant", contents=["done"])])
return _get_response()
def _build_messages() -> list[Message]:
return [
Message(role="user", text="Collect the deployment requirements."),
Message(role="assistant", text="I will gather the constraints first."),
Message(role="user", text="Summarize the rollout risks."),
Message(role="assistant", text="The main risks are drift, downtime, and rollback gaps."),
Message(role="user", contents=["Collect the deployment requirements."]),
Message(role="assistant", contents=["I will gather the constraints first."]),
Message(role="user", contents=["Summarize the rollout risks."]),
Message(role="assistant", contents=["The main risks are drift, downtime, and rollback gaps."]),
]
@@ -51,15 +51,15 @@ class LocalSummaryClient:
options: dict[str, Any] | None = None,
**kwargs: Any,
) -> ChatResponse:
return ChatResponse(messages=[Message(role="assistant", text=f"Summary for {len(messages)} messages.")])
return ChatResponse(messages=[Message(role="assistant", contents=[f"Summary for {len(messages)} messages."])])
async def main() -> None:
# 1. Build one baseline history and print it once.
messages = [
Message(role="system", text="You are a helpful assistant."),
Message(role="user", text="Plan a data migration."),
Message(role="assistant", text="I will gather requirements."),
Message(role="system", contents=["You are a helpful assistant."]),
Message(role="user", contents=["Plan a data migration."]),
Message(role="assistant", contents=["I will gather requirements."]),
Message(
role="assistant",
contents=[
@@ -79,9 +79,9 @@ async def main() -> None:
)
],
),
Message(role="assistant", text="I found three core tables."),
Message(role="user", text="Estimate effort and risks."),
Message(role="assistant", text="Primary risk is schema drift."),
Message(role="assistant", contents=["I found three core tables."]),
Message(role="user", contents=["Estimate effort and risks."]),
Message(role="assistant", contents=["Primary risk is schema drift."]),
]
print("\n--- Before compaction ---")
print(f"Message count: {len(messages)}")
@@ -50,11 +50,11 @@ class KeepLastUserTurnStrategy:
def _messages() -> list[Message]:
return [
Message(role="system", text="You are concise."),
Message(role="user", text="first request"),
Message(role="assistant", text="first response"),
Message(role="user", text="second request"),
Message(role="assistant", text="second response"),
Message(role="system", contents=["You are concise."]),
Message(role="user", contents=["first request"]),
Message(role="assistant", contents=["first response"]),
Message(role="user", contents=["second request"]),
Message(role="assistant", contents=["second response"]),
]
@@ -45,30 +45,34 @@ class TiktokenTokenizer(TokenizerProtocol):
def _build_messages() -> list[Message]:
return [
Message(role="system", text="You are a migration assistant."),
Message(role="system", contents=["You are a migration assistant."]),
Message(
role="user",
text="List all migration risks and include detailed mitigations for each risk category.",
contents=["List all migration risks and include detailed mitigations for each risk category."],
),
Message(
role="assistant",
text=(
"Primary risks include schema drift, missing foreign key constraints, "
"and data quality regressions. Mitigations include staged validation, "
"shadow writes, and replay-based verification."
),
contents=[
(
"Primary risks include schema drift, missing foreign key constraints, "
"and data quality regressions. Mitigations include staged validation, "
"shadow writes, and replay-based verification."
)
],
),
Message(
role="user",
text=("Now provide a detailed checklist with owners, rollback gates, and validation criteria."),
contents=[("Now provide a detailed checklist with owners, rollback gates, and validation criteria.")],
),
Message(
role="assistant",
text=(
"Checklist: baseline snapshots, migration dry-run, production "
"canary, progressive deployment, automated integrity checks, and "
"post-migration reconciliation."
),
contents=[
(
"Checklist: baseline snapshots, migration dry-run, production "
"canary, progressive deployment, automated integrity checks, and "
"post-migration reconciliation."
)
],
),
]