Let’s say you have some data

# Works with a list, dataset or generator
data = [
  "US tops 5 million confirmed virus cases",
  "Canada's last fully intact ice shelf has suddenly collapsed, forming a Manhattan-sized iceberg",
  "Beijing mobilises invasion craft along coast as Taiwan tensions escalate",
  "The National Park Service warns against sacrificing slower friends in a bear attack",
  "Maine man wins $1M from $25 lottery ticket",
  "Make huge profits without work, earn up to $100,000 a day"
]

and you want to create an Index

First, create an Embedding object

from txtai import Embeddings

embeddings = Embeddings(
        {
            "transform": get_openai_embeddings,
            "backend": "numpy",
            "content": True,
            "archive": None
        }
)

Now, you can index your data

# Create an index for the list of text
embeddings.index(data)