Quickstart¶
Embed some sentences¶
Let’s embed some sentences to make sure the client is working.
import basilica
sentences = [
"This is a sentence!",
"This is a similar sentence!",
"I don't think this sentence is very similar at all...",
]
with basilica.Connection('SLOW_DEMO_KEY') as c:
embeddings = list(c.embed_sentences(sentences))
print(embeddings)
[[0.8556405305862427, ...], ...]
Let’s also make sure these embeddings make sense, by checking that the cosine distance between the two similar sentences is smaller:
from scipy import spatial
print(spatial.distance.cosine(embeddings[0], embeddings[1]))
print(spatial.distance.cosine(embeddings[0], embeddings[2]))
0.024854343247535327
0.25084750542635814
Great!
Get an API key¶
The example above uses the slow demo key. You can get an API key of your own by signing up at https://www.basilica.ai/accounts/register . (If you already have an account, you can view your API keys at https://www.basilica.ai/api-keys .)
What next?¶
- Read the documentation for the python client: Basilica Python Client
- See an in-depth tutorial on training an image model: How To Train An Image Model With Basilica