feat: orchestrate grounded recommendations
This commit is contained in:
parent
751391e6a2
commit
cead39edbc
8 changed files with 1098 additions and 7 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import json
|
||||
import re
|
||||
from collections.abc import AsyncIterator
|
||||
from collections.abc import AsyncGenerator
|
||||
from typing import Literal, cast
|
||||
|
||||
from anthropic import AsyncAnthropic
|
||||
|
|
@ -124,7 +124,7 @@ class AnthropicRecommender:
|
|||
history: tuple[ConversationTurn, ...],
|
||||
selection_count: int,
|
||||
correction: str | None = None,
|
||||
) -> AsyncIterator[RerankSelection]:
|
||||
) -> AsyncGenerator[RerankSelection]:
|
||||
"""Yield each complete valid selection while the JSON is streaming."""
|
||||
schema = transform_schema(RerankOutput.model_json_schema())
|
||||
parser = _RecommendationObjectParser()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue