Skip to main content
These properties allow you to customize the behavior and appearance of the SofIA SDK component to fit the specific needs of your implementation.

Interface Control

PropertyTypeDescription
isopenbooleanComponent visibility state, allows bidirectional control of the open/closed state

Callbacks

PropertyTypeDescription
handle-reportfunctionCallback function that receives the structured clinical report generated by SofIA. Can be referenced as a global function or use events
set-is-openfunctionCallback function to handle visibility changes requested by the component

Contextual Data

PropertyTypeDefault ValueDescription
patientdatastring (JSON) | objectundefinedContextual patient information (background, previous notes, referrals) to enrich clinical processing
transcriptorselectvaluesstring (JSON)undefinedConfiguration for the audio transcriber’s selector values

Feature Control

PropertyTypeDefault ValueDescription
isonlychatbooleanfalseHides the audio transcription module, keeping only the chat functionality
disableactionsbooleanfalseDisables all action buttons (Generate, Fill)
disablegeneratebooleanfalseDisables only the Generate button, keeping Fill active

UI Customization

PropertyTypeDefault ValueDescription
sofiatitlestring"Sofia Assistant"Text displayed in the component’s header

Debugging

PropertyTypeDefault ValueDescription
debugbooleanfalseEnables detailed logging for debugging purposes

Localization

PropertyTypeDefault ValueDescription
languagestring"es"Interface language. Supported values: "es" (Spanish), "en" (English)

UI States

PropertyTypeDefault ValueDescription
isscreenloadingbooleanfalseForces the global loading indicator to be displayed in the component

Advanced Callbacks

PropertyTypeDefault ValueDescription
render-report-contentfunctionundefinedA function to customize the rendering of the report’s content
set-get-last-reportfunctionundefinedA callback that receives a function to retrieve the last generated report
toaststring (JSON)undefinedConfiguration for toast notifications to display messages to the user

Manual Report Retrieval

In addition to receiving the report automatically, you can request it on-demand from your application. The set-get-last-report property executes a callback that provides you with an asynchronous function. You should store this reference to use it whenever you need to retrieve the last generated report.
let getLastReportFn = null;

// Callback assigned to: set-get-last-report
function registerGetter(fn) {
  getLastReportFn = fn;
}

// Example of use in an external button
async function handleSaveClick() {
  if (getLastReportFn) {
    const report = await getLastReportFn();
    console.log("Report retrieved:", report);
  }
}

Usage Examples

Basic setup with patient data

<sofia-sdk
  patientdata='{"age": 45, "history": "Arterial hypertension"}'
  language="es"
  sofiatitle="Cardiology Consultation"
  baseurl="https://api.example.com"
  wssurl="wss://ws.example.com"
  apikey="your-key"
  userid="doc123"
  patientid="pat456"
  toolsargs='{"type": "object"}'
  isopen="true"
  handle-report="handleReport"
  set-is-open="setIsOpen"
>
</sofia-sdk>

Chat-only mode for quick consultations

<sofia-sdk
  isonlychat="true"
  sofiatitle="Quick Consultation"
  <!-- required properties... -->
>
</sofia-sdk>

Configuration with limited actions and data sources

<sofia-sdk
  disablegenerate="true"
  isscreenloading="true"
  language="en"
  transcriptorselectvalues='{"model": "whisper", "language": "es"}'
  <!-- required properties... -->
>
</sofia-sdk>

Advanced configuration with callbacks

<sofia-sdk
  render-report-content="customRenderFunction"
  set-get-last-report="setGetReportFunction"
  toast='{"message": "Report generated", "type": "success"}'
  <!-- required properties... -->
>
</sofia-sdk>

Important Notes

  • patientdata: Should only contain information necessary for the clinical context, following data minimization principles.
  • Dimensions: Units can be px, %, em, rem, or any other valid CSS unit.
  • States: Changes in boolean properties are immediately reflected in the interface.
  • Localization: Changing the language affects the entire component interface, including error messages and labels.
  • Callbacks: Functions can be referenced by their global name or handled via DOM events.