yigitkonur / swift-ocr-llm-powered-pdf-to-markdown

An open-source OCR API that leverages OpenAI's powerful language models with optimized performance techniques like parallel processing and batching to deliver high-quality text extraction from complex PDF documents. Ideal for businesses seeking efficient document digitization and data extraction solutions.
Other
674 stars 49 forks source link

How to config api key #7

Closed Ymars1990 closed 1 month ago

Ymars1990 commented 1 month ago

OPENAI_API_KEY=your_openai_api_key AZURE_OPENAI_ENDPOINT=your_azure_openai_endpoint OPENAI_DEPLOYMENT_ID=your_openai_deployment_id OPENAI_API_VERSION=your_openai_api_version # Default is "gpt-4o" BATCH_SIZE=10 # Optional: Default is 1 MAX_CONCURRENT_OCR_REQUESTS=5 # Optional: Default is 5 MAX_CONCURRENT_PDF_CONVERSION=4 # Optional: Default is 4

I have AZURE api key,but i don't know how to config openai_api key .

yigitkonur commented 1 month ago

When setting up your Azure OpenAI configuration, you'll need to input a few key pieces of information. First, for the AZURE_OPENAI_ENDPOINT, you'll use your unique endpoint URL. This typically looks something like "https://yourusername.openai.azure.com/". (this is the name you give the resource when your create Azure OpenAI service)

Next, you'll need to provide your OPENAI_API_KEY. You can find this in the API KEY section after you've created a resource in Azure. It's a crucial piece of information that authenticates your requests.

In the Deployment section of Azure, you'll create a model. The system often automatically names this "gpt-4o", and this becomes your OPENAI_DEPLOYMENT_ID. Don't worry if it's named differently; just use whatever name Azure assigns.

For the API version, you don't need to stress too much about it. Using "2023-07-01-preview" should work fine in most cases.

If you run into any snags during setup, don't hesitate to seek help. A great trick is to copy your entire code along with any error messages you're seeing and paste it into ChatGPT. They're pretty good at helping you troubleshoot and find solutions.