Skip to content

Commit af0abc2

Browse files
committed
Structured changes
1 parent 9baaf4d commit af0abc2

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

examples/workflow_aggregator_structured.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from azure.identity.aio import DefaultAzureCredential, get_bearer_token_provider
2222
from dotenv import load_dotenv
2323
from pydantic import BaseModel, Field
24-
from typing_extensions import Never
24+
from typing_extensions import Literal, Never
2525

2626
load_dotenv(override=True)
2727
API_HOST = os.getenv("API_HOST", "github")
@@ -51,10 +51,15 @@
5151
class CandidateReview(BaseModel):
5252
"""Typed output produced by the reviewer — suitable for APIs, databases, or scoring engines."""
5353

54-
technical_assessment: str = Field(description="Summary of the candidate's technical strengths and gaps.")
55-
behavioral_assessment: str = Field(description="Summary of the candidate's behavioral strengths and gaps.")
56-
cultural_assessment: str = Field(description="Summary of the candidate's cultural fit strengths and gaps.")
57-
recommendation: str = Field(description="One of: strong hire, hire with reservations, no hire.")
54+
technical_score: int = Field(description="Technical skills score from 1 to 10.")
55+
technical_reason: str = Field(description="Justification for the technical score.")
56+
behavioral_score: int = Field(description="Behavioral skills score from 1 to 10.")
57+
behavioral_reason: str = Field(description="Justification for the behavioral score.")
58+
cultural_score: int = Field(description="Cultural fit score from 1 to 10.")
59+
cultural_reason: str = Field(description="Justification for the cultural score.")
60+
recommendation: Literal["strong hire", "hire with reservations", "no hire"] = Field(
61+
description="Final hiring recommendation."
62+
)
5863

5964

6065
class DispatchPrompt(Executor):
@@ -144,7 +149,7 @@ async def extract(
144149
async def main() -> None:
145150
"""Run the interview pipeline and print the typed review."""
146151
prompt = (
147-
"Candidate: Alex Chen, applying for Senior Software Engineer. "
152+
"Candidate applying for Senior Software Engineer. "
148153
"5 years experience in Python and distributed systems. "
149154
"Strong communicator but limited cloud experience."
150155
)
@@ -153,9 +158,9 @@ async def main() -> None:
153158
events = await workflow.run(prompt)
154159
for output in events.get_outputs():
155160
print(f"Recommendation: {output.recommendation}\n")
156-
print(f"Technical Assessment:\n{output.technical_assessment}\n")
157-
print(f"Behavioral Assessment:\n{output.behavioral_assessment}\n")
158-
print(f"Cultural Assessment:\n{output.cultural_assessment}")
161+
print(f"Technical: {output.technical_score}/10 — {output.technical_reason}\n")
162+
print(f"Behavioral: {output.behavioral_score}/10 — {output.behavioral_reason}\n")
163+
print(f"Cultural: {output.cultural_score}/10 — {output.cultural_reason}")
159164

160165
if async_credential:
161166
await async_credential.close()

0 commit comments

Comments
 (0)