> ## Documentation Index
> Fetch the complete documentation index at: https://dokulabs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Embeddings

> Monitor OpenAI Embeddings API usage

## Create Embeddings

**Python**

```python
from openai import OpenAI
import dokumetry

client = OpenAI(
  api_key = "YOUR_OPENAI_API_KEY"
)

# Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.
dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")

client.embeddings.create(
  model="text-embedding-ada-002",
  input="The food was delicious and the waiter...",
  encoding_format="float"
)
```

**javascript**

```javascript
import OpenAI from "openai";
import DokuMetry from 'dokumetry';

const openai = new OpenAI();

// Pass the above `openai` object along with your Doku Ingester URL and API key and this will make sure that all OpenAI calls are automatically tracked.
DokuMetry.init({llm: openai, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})

async function main() {
  const embedding = await openai.embeddings.create({
    model: "text-embedding-ada-002",
    input: "The quick brown fox jumped over the lazy dog",
    encoding_format: "float",
  });

  console.log(embedding);
}

main();
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.