Skip to content

Commit

Permalink
chore: improve concurrency limit
Browse files Browse the repository at this point in the history
  • Loading branch information
arshad-yaseen committed Jan 9, 2025
1 parent 84bfa94 commit f0dde5e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ Fast, ultra-accurate text extraction from any image or PDF—including challengi
- [Browser-Specific Implementation](#browser-specific-implementation)
- [Contributing](#contributing)

## Supported Files

- PDF documents (\*.pdf)
- PNG (\*.png)
- JPEG/JPG (\*.jpg, \*.jpeg)
- WebP (\*.webp)
- GIF (\*.gif, first frame only)
- BMP (\*.bmp)
- TIFF (\*.tiff, \*.tif)
- SVG (\*.svg)

## Installation

### Prerequisites
Expand Down
8 changes: 1 addition & 7 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const SUPPORTED_PROVIDERS = ['openai'] as const;
/**
* Maximum number of concurrent API requests.
*/
export const MAX_CONCURRENT_REQUESTS = 100;
export const MAX_CONCURRENT_REQUESTS = 10;

/**
* Request timeout in milliseconds.
Expand All @@ -31,9 +31,3 @@ export const RETRY_DELAY = 1_000;
export const API_ENDPOINTS: Record<Provider, string> = {
openai: 'https://api.openai.com/v1/chat/completions',
};

/**
* Prompt template for the LLM.
*/
export const DEFAULT_PROMPT_TEMPLATE =
'Extract all visible text from this image. Format the output as markdown. Include only the text content, no explanations or additional context. Fix any formatting issues, typos, or inconsistencies found in the extracted content.';
6 changes: 6 additions & 0 deletions src/constants/llm.ts
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
export const DEFAULT_MODEL_TEMPERATURE = 0.1;

/**
* Prompt template for the LLM.
*/
export const DEFAULT_PROMPT_TEMPLATE =
'Extract all visible text from this image and format the output as markdown. Include only the text content; no explanations or additional text should be included. If the image is empty, return an empty string. Fix any formatting issues or inconsistencies found in the extracted content.';
6 changes: 4 additions & 2 deletions src/utils/provider.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import {DEFAULT_PROMPT_TEMPLATE} from '../constants';
import {DEFAULT_MODEL_TEMPERATURE} from '../constants/llm';
import {
DEFAULT_MODEL_TEMPERATURE,
DEFAULT_PROMPT_TEMPLATE,
} from '../constants/llm';
import type {
OpenAIChatCompletion,
OpenAIChatCompletionCreateParams,
Expand Down

0 comments on commit f0dde5e

Please sign in to comment.