Create Vectors using AddV  

Create new vector embeddings in your graph.
AddV<Type>
AddV<Type>(vector, {properties})
Currently, Helix only supports using an array of F64 values to represent the vector. We will be adding support for different types such as F32, binary vectors and more in the very near future. Please reach out to us if you need a different vector type.
When using the SDKs or curling the endpoint, the query name must match what is defined in the queries.hx file exactly.

Example 1: Creating a vector with no properties

QUERY InsertVector (vector: [F64]) =>
    vector_node <- AddV<Document>(vector)
    RETURN vector_node
Heres how to run the query using the SDKs or curl
from helix.client import Client

client = Client(local=True, port=6969)

print(client.query("InsertVector", {
    "vector": [0.1, 0.2, 0.3, 0.4],
}))

Example 2: Creating a vector with properties

QUERY InsertVector (vector: [F64], content: String, created_at: Date) =>
    vector_node <- AddV<Document>(vector, { content: content, created_at: created_at })
    RETURN vector_node
Heres how to run the query using the SDKs or curl
from datetime import datetime, timezone
from helix.client import Client

client = Client(local=True, port=6969)

payload = {
    "vector": [0.12, 0.34, 0.56, 0.78],
    "content": "Quick brown fox",
    "created_at": datetime.now(timezone.utc).isoformat(),
}

print(client.query("InsertVector", payload))

Example 3: Creating a vector and connecting it to a node

QUERY InsertVector (user_id: ID, vector: [F64], content: String, created_at: Date) =>
    user <- N<User>(user_id)
    vector_node <- AddV<Document>(vector, { content: content, created_at: created_at })
    AddE<User_to_Document_Embedding>::From(user)::To(vector_node)
    RETURN "Success"

QUERY CreateUser (name: String, age: U8, email: String) =>
    user <- AddN<User>({
        name: name,
        age: age,
        email: email
    })
    RETURN user
Heres how to run the query using the SDKs or curl
from datetime import datetime, timezone
from helix.client import Client

client = Client(local=True, port=6969)

user = client.query("CreateUser", {
    "name": "Alice",
    "age": 25,
    "email": "alice@example.com",
})
user_id = user[0]["user"]["id"]

payload = {
    "user_id": user_id,
    "vector": [0.05, 0.25, 0.5, 0.75],
    "content": "Favorite quotes",
    "created_at": datetime.now(timezone.utc).isoformat(),
}

print(client.query("InsertVector", payload))

Example 4: Using the built in Embed function

You can also use the built in Embed function to embed the text without sending in the array of floats. It uses the embedding model defined in your config.hx.json file.
QUERY InsertVector (content: String, created_at: Date) =>
    vector_node <- AddV<Document>(Embed(content), { content: content, created_at: created_at })
    RETURN vector_node
Heres how to run the query using the SDKs or curl
from datetime import datetime, timezone
from helix.client import Client

client = Client(local=True, port=6969)

payload = {
    "content": "Quick summary of a meeting",
    "created_at": datetime.now(timezone.utc).isoformat(),
}

print(client.query("InsertVector", payload))