General Concepts
Sync & Async Client
UiForm offers both synchronous and asynchronous client interfaces, making it versatile for different application needs. The asynchronous client (AsyncUiForm
) is ideal for high-performance, non-blocking applications where multiple tasks run concurrently. For simpler or blocking operations, the synchronous client (UiForm
) provides a straightforward approach.
Here’s how you can use both:
Both clients provide the same core functionality, enabling you to list models, create messages, extract data from documents, and more, with the flexibility to match your application’s concurrency model.
Rate Limits
UiForm implements rate limiting to ensure stable service for all users. The API uses a rolling window rate limit with the following configuration:
- 300 requests per 60-second window
- Applies across the following API endpoints:
POST /api/v1/documents/extractions
POST /api/v1/documents/create_messages
When you exceed the rate limit, the API will return a 429 Too Many Requests
response. The response headers will include:
For high-volume applications, we can provide a dedicated plan. Contact us for more information.
Modality
LLM works with text and image data. UiForm converts documents into different modalities, based on the document type.
Native modalities
Here are the list of native modalities supported by UiForm:
You can also use the modality
parameter to specify the modality of the document and override the default modality.
Idempotency
Idempotency in UIForm ensures that repeated API requests with the same idempotency key are handled consistently without duplicating processing or generating unintended side effects. When a request is made, UIForm checks if a record with the same idempotency key exists in its database. If a match is found:
- If the request content matches the original request: The previously computed response is returned.
- If the request content differs: An error is returned, indicating a conflict.
- If the original request is still being processed: The API prevents concurrent execution by blocking duplicate processing.
By leveraging idempotency, UIForm ensures each document or operation is processed only once, returning consistent results and avoiding unnecessary computation.
Text Operations
When processing documents, you may want to provide additional context to help the AI better understand the document. This could be previous communications, related documents, or any other relevant information.
Regex Instructions
Define custom patterns to extract specific data types:
- Document Numbers: Extract invoice numbers, PO numbers, etc.
- Custom Formats: Identify company-specific identifiers
- Validation: Ensure extracted data matches expected patterns
Best Practices
- Use consistent formatting in regex patterns
- Only use regex patterns to extract data that is not easily extracted by the LLM
API Reference
Mathematical operations performed on the text to help the AI better extract the data.
Image Operations (Coming Soon)
When processing images, several factors can affect the LLM’s ability to accurately interpret and extract information. The image_operations parameter allows you to preprocess images to improve extraction quality.
API Reference
Image preprocessing operations to optimize document analysis.