Installation
Install the screen template by running the following command:screens/legacy-document-reasoning-screen.tsx.
Usage
Required Props
Example
workflow.py
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
A screen template for document reasoning tasks and Q&A interactions
npx shadcn add https://registry.samplehc.com/r/legacy-document-reasoning.json
screens/legacy-document-reasoning-screen.tsx.
| Name | Type | Description |
|---|---|---|
resultId | string | The async result ID returned from a document reasoning API call |
from workflows_py.workflow import ScreenStep, Step, Workflow
from client_manager import SampleHealthcareClient
workflow = Workflow(...)
def reason_document(ctx):
client = SampleHealthcareClient()
document = ctx.get_step_result("document-upload")["document"]
response = client.v2.documents.legacy.reason(
documents=[{"id": document["id"], "fileName": document["fileName"]}],
task={
"id": "reasoning-task-1",
"description": "Extract key medical information from the document",
"label": "Medical Information Extraction",
"type": "reasoning"
}
)
return response.async_result_id
workflow.then(
# See: Document Upload Screen template
ScreenStep(
"document-upload",
screen_path="./screens/document-upload-screen.tsx",
)
).then(
Step(
"reason-document",
reason_document,
)
)
.then(
ScreenStep(
"document-reasoning",
screen_path="./screens/legacy-document-reasoning-screen.tsx",
get_props=lambda ctx: {"resultId": ctx.get_step_result("reason-document")},
)
)
| Name | Type | Description |
|---|---|---|
tasks | array | Array of task objects that were processed |
initial_answers | array | Array of initial answers generated by the AI for each task |
initial_answers[].answer | object | Rich text content of the initial AI-generated answer |
final_answers | array | Array of final answers after user review and editing |
final_answers[].answer | object | Rich text content of the final user-reviewed answer |