There are multiple parameters you can use to configure Documind when extracting data from documents.
Models - model
This allows you specify the model you want to use to perform an extraction. You can choose from the following models:
| Provider | Models | Variable |
|---|
| OpenAI | gpt-4o-mini
gpt-4o | OPENAI_API_KEY |
| Google | gemini-2.0-flash-001
gemini-2.0-flash-lite-preview-02-05 | GEMINI_API_KEY |
| Ollama | llava
llama3.2-vision | BASE_URL |
If you don’t set a model, by default Documind will use gpt-4o-mini.
import { extract } from 'documind';
const result = await extract({
file: 'https://example.com/document.pdf',
model: 'llama3.2-vision'
});
console.log(result);
Templates - template
To use a template, simply pass the name of the template in the extract function:
import { extract } from 'documind';
const result = await extract({
file: 'https://example.com/document.pdf',
template: 'invoice', // Specify the template name
});
console.log(result);
Read more about creating and using templates.
Autoschema - autoschema
The autoschema function allows Documind to automatically generate a schema for you based on the content of yoru document.
You can use autoSchema in two ways.
- Simply set the
autoSchema property to true to create a generic schema that covers your entire document.
import { extract } from 'documind';
const result = await extract({
file: 'https://example.com/document.pdf',
autoSchema: true
});
console.log(result);
- Or you can give instructions in plain English detailing what you want to extract.
import { extract } from 'documind';
const result = await extract({
file: 'https://example.com/document.pdf',
autoSchema: {
instructions: 'Extract the name of the opening and closing balance from the bank statement.'
}
});
console.log(result);
You can only select one of template, schema, or autoSchema.