Upload files to "Embeddings"

This commit is contained in:
2026-05-06 13:36:39 +03:30
commit 317c35f0cb

View File

@@ -0,0 +1,40 @@
# Developer Guidance: OpenAI-Compatible Embeddings
## Overview
This project uses the OpenAI Python SDK with a compatible base URL to call embeddings.
## Example Usage
```python
from openai import OpenAI
client = OpenAI(
base_url="https://api.gapgpt.app/v1",
api_key="YOUR_SECRET_KEY_HERE"
)
response = client.embeddings.create(
model="text-embedding-3-small",
input="متن برای تبدیل به بردار"
)
print(response.data[0].embedding[:5])
```
## Secret Key Placeholder
Replace `YOUR_SECRET_KEY_HERE` with your actual secret key.
### Recommended: Use an environment variable
```python
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.gapgpt.app/v1",
api_key=os.getenv("OPENAI_API_KEY")
)
```
## Notes
- Do **not** commit your secret key to source control.
- Store secrets in `.env` files or your deployment secret manager.
- Use the embedding output as needed in your application.