Embedded Weaviate
Embedded Weaviate is a deployment model that runs a Weaviate instance from your application code rather than from a stand-alone Weaviate server installation.
When Embedded Weaviate starts for the first time, it creates a permanent datastore in the location set in your persistence_data_path
. When your client exits, the Embedded Weaviate instance also exits, but the data persists.
The next time the client runs, the client starts a new instance of Embedded Weaviate. New Embedded Weaviate instances use the data that is saved in the datastore.
For more details on using Embedded Weaviate, see Embedded Weaviate.
Start an Embedded Weaviate instance
- Python Client v4
- Python Client v3
- JS/TS Client v2
import weaviate
import os
# Best practice: store your credentials in environment variables
openai_api_key = os.environ["OPENAI_API_KEY"]
client = weaviate.connect_to_embedded(
version="1.26.1",
headers={
"X-OpenAI-Api-Key": openai_api_key
},
)
# Add your client code here.
# When the client exits, the embedded instance also exits
import weaviate
from weaviate.embedded import EmbeddedOptions
client = weaviate.Client(
embedded_options=EmbeddedOptions()
)
# Add your client code here.
# When the client exits, the embedded instance also exits
import weaviate, { EmbeddedOptions } from 'weaviate-ts-embedded';
const client = weaviate.client(new EmbeddedOptions());
await client.embedded.start();
// Add your client code here.
// When the client exits, the embedded instance also exits
client.embedded.stop();
Questions and feedback
If you have any questions or feedback, let us know in the user forum.