Ingest URI with Workflow
User Intent
"I want to apply custom extraction, preparation, or processing to content during ingestion"
Operation
SDK Method:
graphlit.ingestUri()with workflow parameterGraphQL:
ingestUrimutation with workflow referenceEntity Type: Content + Workflow
Common Use Cases: Entity extraction, vision-based PDF parsing, audio transcription with custom models
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
uri(string): URL of the content to ingestworkflow(EntityReferenceInput): Workflow ID to apply
Optional
collections(EntityReferenceInput[]): Collections to assign content toisSynchronous(boolean): Wait for workflow completion (recommended: true)
Response
Variations
1. Vision-Based PDF Extraction
Use vision models for better PDF text extraction:
2. Audio Transcription Workflow
Transcribe audio/video with custom settings:
3. Combined Preparation + Extraction
Chain preparation and extraction in one workflow:
4. Workflow with Custom Actions
Execute custom code during workflow:
Common Issues
Issue: Workflow not found
Solution: Ensure workflow ID is valid and belongs to your project. Create workflow first.
Issue: Workflow takes too long / times out Solution: Use asynchronous ingestion for large files:
Issue: Entities not extracted
Solution: Check workflow extraction.jobs[].connector.extractionTypes matches content type.
Issue: Vision extraction not working
Solution: Ensure useVision: true in preparation workflow and content is PDF or image.
Last updated
Was this helpful?