Skip to content

Commit e2a0540

Browse files
committed
Fix topic_generator.py after contraint decoding changes.
PiperOrigin-RevId: 789752361
1 parent 53af978 commit e2a0540

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

examples/research/processors/topic_generator.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,18 +112,9 @@ def __init__(
112112
async def call(
113113
self, content: AsyncIterable[ProcessorPart]
114114
) -> AsyncIterable[ProcessorPart]:
115-
json_parts = []
115+
topics = []
116116
async for content_part in self._pipeline(content):
117-
json_parts.append(content_part)
118-
119-
json_res = json.loads(content_api.as_text(json_parts))
120-
topics = [
121-
interfaces.Topic(
122-
topic=t.get('topic'),
123-
relationship_to_user_content=t.get('relationship_to_user_content'),
124-
)
125-
for t in json_res
126-
]
117+
topics.append(content_part.get_dataclass(interfaces.Topic))
127118

128119
yield processor.status(f'Generated {len(topics)} topics to research!')
129120
for i, t in enumerate(topics):

0 commit comments

Comments
 (0)