Ingest Text
Content: Ingest Text
User Intent
"I want to ingest plain text directly into Graphlit without a file or URL"
Operation
SDK Method:
graphlit.ingestText()GraphQL:
ingestTextmutationEntity Type: Content
Common Use Cases: User-generated notes, chat messages, API responses, scraped text, clipboard content
TypeScript (Canonical)
import { Graphlit } from 'graphlit-client';
import { ContentState, ObservableTypes } from 'graphlit-client/dist/generated/graphql-types';
const graphlit = new Graphlit();
// Basic text ingestion (synchronous)
const response = await graphlit.ingestText(
'This is my note about the project meeting. We discussed Q1 goals and timeline.', // text
'Meeting Notes - January 2025', // name
undefined, // textType (optional)
undefined, // uri (optional - for reference)
undefined, // id (optional)
undefined, // identifier (optional)
true, // isSynchronous
undefined, // workflow (optional)
undefined // collections (optional)
);
const contentId = response.ingestText.id;
console.log(`Text ingested: ${contentId}`);
// Retrieve the content
const content = await graphlit.getContent(contentId);
console.log(`Content markdown: ${content.content.markdown}`);Ingest text (snake_case method)
Note: Python SDK uses named parameters, order doesn't matter
response = await graphlit.ingestText( text="This is my note about the project meeting.", name="Meeting Notes - January 2025", is_synchronous=True )
content_id = response.ingest_text.id if response.ingest_text else None
Parameters
Required
text(string): The text content to ingestCan be plain text or markdown
No size limit specified, but keep reasonable for performance
Optional
name(string): Display name for the contenttextType(TextTypes): Type hint for the textPLAIN- Plain text (default)MARKDOWN- Markdown formatted text
uri(string): Optional reference URI for the text sourceid(string): Custom ID for the contentidentifier(string): Custom identifier for deduplicationisSynchronous(boolean): Wait for ingestion to completeDefault:
false(asynchronous)Recommended:
truefor immediate use
workflow(EntityReferenceInput): Workflow to apply during ingestioncollections(EntityReferenceInput[]): Collections to add content toobservations(ObservationReferenceInput[]): Observations to linkcorrelationId(string): For tracking in production systems
Response
Developer Hints
Key Differences from ingestUri
No file parsing needed - Text is used directly, no extraction step
Immediate availability - Even with
isSynchronous: false, text is usually available immediatelyNo file metadata - No fileType, mimeType, or file-specific fields
Markdown support - Can ingest pre-formatted markdown
When to Use ingestText vs ingestUri
Use ingestText when:
You already have the text in memory
Text comes from user input, API, or database
No file parsing needed
You want to store snippets, notes, or short content
Use ingestUri when:
Content is in a file (PDF, DOCX, etc.)
Need file parsing/extraction
Content is at a URL
Understanding isSynchronous
For ingestText, the difference is minimal since text doesn't require heavy processing. However, if you're using a workflow (e.g., entity extraction), synchronous mode ensures the workflow completes before returning.
Variations
1. Ingesting with Collections
Organize text into collections during ingestion:
2. Ingesting Markdown
Preserve markdown formatting:
3. Ingesting with Entity Extraction
Apply a workflow to extract entities from text:
4. Ingesting with Reference URI
Track the source of text:
Common Issues
Issue: Text ingested but not appearing in search Solution: Ensure embeddings are generated. Check project configuration for embedding model. If using asynchronous mode, wait a few seconds for embedding generation.
Issue: Special characters or formatting lost
Solution: Use textType: TextTypes.Markdown if your text includes markdown formatting. Plain text is default.
Issue: Workflow not executing
Solution: Must use isSynchronous: true when applying workflows. Asynchronous mode may return before workflow completes.
Issue: Content state is AWAITING_EXTRACTION
Solution: Wait for processing to complete if using asynchronous mode. Or switch to synchronous mode.
Production Example
From Public Samples:
Re-ingesting updated text:
Last updated
Was this helpful?