How does nearText works?

I would be easier if it was an string, but since it’s an array
How does it works the concepts?

Does it generates an embedding for each concepts and then somehow merges them when searching?

Or does it merges the string, generates the embeddings for that single string and then searchs based on that?

Hi @rodjosh !

Welcome to our community :hugs:

In pyv4, You can pass a single string, or a list of strings, as the the embeddings api usually allows it, like so:

import os
import requests

headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer ' + os.getenv('OPENAI_API_KEY', ''),
}

json_data = {
    'input': ['This is a text', 'another one'],
    'model': 'text-embedding-ada-002',
}

response = requests.post('https://api.openai.com/v1/embeddings', headers=headers, json=json_data)

Let me know if this helps :slight_smile: