Files
landing_page/qdrant-landing/content/documentation/integrations/openai.md
T
3215985d1d Improved Nested Docs and Link Grouping Support (#147)
* added a table of content

* wide layout for docs, styles for the table of content

* fixes for docs layout

* wide footer at the docs section

* added support for nested docs, added toggling groups of links, delimiters, external links

* external link icon

* added active state for nested links, styles for the external link icon

* styles fix

* remove doc sync

* update directory structure and doc titles

* fix outstanding links

* fix more links for merge

* Revert "fix more links for merge"

This reverts commit 46c9ccaf1b7765f2cda8dc85d625fa6b4e3f5436.

* Revert "fix outstanding links"

This reverts commit 28e6380b74f1ab74690c8184551f186656d6d4e9.

* fix remaining broken links

* move how-to tutorials in the different page

* split tutorials

* fix link

* upd github edit link

* skip empty index pages

---------

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
Co-authored-by: David Sertic <62056091+davidmyriel@users.noreply.github.com>
2023-05-29 15:11:40 +02:00

45 lines
1.1 KiB
Markdown

---
title: OpenAI
weight: 800
---
# OpenAI
Qdrant can also easily work with [OpenAI embeddings](https://beta.openai.com/docs/guides/embeddings/embeddings). There is an
official OpenAI Python package that simplifies obtaining them, and it might be installed with pip:
```bash
pip install openai
```
Once installed, the package exposes the method allowing to retrieve the embedding for given text. OpenAI requires an API key
that has to be provided either as an environmental variable `OPENAI_API_KEY` or set in the source code directly, as
presented below:
```python
import openai
import qdrant_client
from qdrant_client.http.models import Batch
# Provide OpenAI API key and choose one of the available models:
# https://beta.openai.com/docs/models/overview
openai.api_key = "<< your_api_key >>"
embedding_model = "text-embedding-ada-002"
response = openai.Embedding.create(
input="The best vector database",
model=embedding_model,
)
qdrant_client = qdrant_client.QdrantClient()
qdrant_client.upsert(
collection_name="MyCollection",
points=Batch(
ids=[1],
vectors=[response["data"][0]["embedding"]],
)
)
```