Ingest URI with Workflow
User Intent
Operation
TypeScript (Canonical)
import { Graphlit } from 'graphlit-client';
import {
EntityExtractionServiceTypes,
FilePreparationServiceTypes,
WorkflowActionServiceTypes,
DeepgramModels,
ObservableTypes,
WorkflowInput,
ContentState,
FileTypes,
} from 'graphlit-client/dist/generated/graphql-types';
const graphlit = new Graphlit();
// 1. Create a workflow that extracts people & organizations
const workflowInput: WorkflowInput = {
name: 'Entity Extraction Workflow',
extraction: {
jobs: [
{
connector: {
type: EntityExtractionServiceTypes.ModelText,
modelText: {
extractedTypes: [
ObservableTypes.Person,
ObservableTypes.Organization,
],
},
},
},
],
},
};
const workflowResponse = await graphlit.createWorkflow(workflowInput);
const workflowId = workflowResponse.createWorkflow.id;
// 2. Ingest content with that workflow enabled
const ingestResponse = await graphlit.ingestUri(
'https://example.com/contract.pdf',
'Vendor Contract',
{ id: workflowId },
true, // wait until extraction completes
);
// 3. Retrieve entities extracted during ingestion
const content = await graphlit.getContent(ingestResponse.ingestUri.id);
const entities = content.content.observations ?? [];
console.log(`Extracted ${entities.length} entities`);
console.log(entities.slice(0, 5).map((obs) => `${obs.observable?.type}: ${obs.observable?.name}`));Parameters
Required
Optional
Response
Variations
1. Vision-Based PDF Extraction
2. Audio Transcription Workflow
3. Combined Preparation + Extraction
4. Workflow with Custom Actions
Common Issues
Last updated