### Install and Initialize HelixCLI Source: https://github.com/HelixDB/helix-ts This snippet provides the shell commands required to install the HelixCLI tool by downloading and executing an installation script, followed by initializing the HelixDB environment using the `helix install` and `helix init` commands. This is a prerequisite for interacting with HelixDB. ```shell $ curl -sSL "https://install.helix-db.com" | bash $ helix install $ helix init ``` -------------------------------- ### Install and Initialize HelixCLI Source: https://github.com/HelixDB/helix-ts Commands to install the HelixCLI tool, which is essential for managing HelixDB, and to initialize the local HelixDB environment. ```Bash curl -sSL "https://install.helix-db.com" | bash helix install helix init ``` -------------------------------- ### Rust HelixDB Client Quick Start Example Source: https://github.com/HelixDB/helix-rs This Rust example demonstrates how to initialize the HelixDB client, define serializable and deserializable data structures using Serde, and perform a basic asynchronous query. It showcases connecting to the database, sending an `addUser` command with input data, and processing the returned result. ```rust use helix_rs::HelixDB; use serde::{Serialize, Deserialize}; // Define your data structures #[derive(Serialize)] struct UserInput { name: String, age: i32, } #[derive(Deserialize)] struct UserOutput { id: String, name: String, age: i32, } #[tokio::main] async fn main() -> anyhow::Result<()> { // Initialize the client let client = HelixDB::new(None); // Uses default port 6969 // Create a user let input = UserInput { name: "John".to_string(), age: 20, }; let result: UserOutput = client.query("addUser", &input).await?; println!("Created user with ID: {}", result.id); Ok(()) } ``` -------------------------------- ### Complete Go Client Example for HelixDB Source: https://context7_llms A comprehensive Go program demonstrating the full setup and usage of the HelixDB client. It includes client initialization, defining response structs, creating user data, and executing both 'create_user' and 'get_users' queries. ```go package main import ( "fmt" "log" "time" "github.com/HelixDB/helix-go" ) var HelixClient *helix.Client type GetUsersResponse struct { Users []struct { Name string `json:"name"` Age int32 `json:"age"` Email string `json:"email"` CreatedAt interface{} `json:"created_at"` UpdatedAt interface{} `json:"updated_at"` } `json:"users"` } type CreateUserResponse struct { User struct { Name string `json:"name"` Age int32 `json:"age"` Email string `json:"email"` CreatedAt interface{} `json:"created_at"` UpdatedAt interface{} `json:"updated_at"` } `json:"user"` } func main() { // Connect to client HelixClient = helix.NewClient("http://localhost:6969") // Create user data now := time.Now() timestamp := now.Unix() timestamp32 := int32(timestamp) newUser := map[string]any{ "name": "John", "age": 21, "email": "johndoe@email.com", "now": timestamp32, } // Create user in Helix var createdUser CreateUserResponse err := HelixClient.Query( "create_user", helix.WithData(newUser), ).Scan(&createdUser) if err != nil { log.Fatalf("Error while creating user: %s", err) } fmt.Println("Created user:", createdUser) // Get all users and put Helix's response in GetUsersResponse var getUsersResponse GetUsersResponse err = HelixClient.Query("get_users").Scan(&getUsersResponse) if err != nil { log.Fatalf("Error while getting users: %s", err) } fmt.Println("Get users response:", getUsersResponse) } ``` -------------------------------- ### Rust: Quick Start - Querying and Schema Definition Source: https://context7_llms A comprehensive example demonstrating how to initialize the HelixDB Rust client, define data structures for input and output, execute a query to add a user, and define the corresponding HelixDB query and schema files. ```Rust use helix_db::HelixDB; use serde::{Serialize, Deserialize}; // Define your data structures based on the schema #[derive(Serialize)] struct AddUserInput { name: String, age: i32, } #[derive(Deserialize)] struct AddUserOutput { id: String, name: String, age: i32, } #[tokio::main] async fn main() -> anyhow::Result<()> { // Initialize the client let client = HelixDB::new(None, None); // Uses default endpoint and port http://localhost:6969 // Create a user let input = AddUserInput { name: "John".to_string(), age: 20, }; // Define the output structure #[derive(Deserialize)] struct Result { user: AddUserOutput, } // Run the query let result: Result = client.query::("addUser", &input).await?; println!("Created user with ID: {}", result.user.id); Ok(()) } ``` ```queries.hx QUERY addUser(name: String, age: i32) => user AddN({ name: name, age: age }) RETURN user ``` ```schema.hx N::User { name: String, age: i32 } ``` -------------------------------- ### Quick Start: Basic HelixDB Client Usage in Rust Source: https://github.com/HelixDB/helix-rs This example demonstrates how to initialize the HelixDB client, define custom data structures using Serde for serialization and deserialization, and perform a basic database query. It showcases the asynchronous nature of the client operations using `tokio::main`. ```Rust use helix_rs::HelixDB; use serde::{Serialize, Deserialize}; // Define your data structures #[derive(Serialize)] struct UserInput { name: String, age: i32, } #[derive(Deserialize)] struct UserOutput { id: String, name: String, age: i32, } #[tokio::main] async fn main() -> anyhow::Result<()> { // Initialize the client let client = HelixDB::new(None); // Uses default port 6969 // Create a user let input = UserInput { name: "John".to_string(), age: 20, }; let result: UserOutput = client.query("addUser", &input).await?; println!("Created user with ID: {}", result.id); Ok(()) } ``` -------------------------------- ### Set Up Helix MCP Server Project with uv Source: https://github.com/HelixDB/helix-py These shell commands guide the user through initializing a new project with `uv`, copying the `mcp_server.py` file, setting up a virtual environment, activating it, and installing the `helix-py` package with the `mcp[cli]` extras. ```shell uv init project cp mcp_server.py project cd project uv venv && source .venv/bin/activate uv add helix-py "mcp[cli]" ``` -------------------------------- ### Install HelixDB Go SDK Source: https://context7_llms This Bash command installs the HelixDB Go SDK using `go get`. It fetches the necessary packages from the GitHub repository, making the SDK available for use in your Go projects. ```bash go get github.com/HelixDB/helix-go ``` -------------------------------- ### Install and Initialize HelixCLI Source: https://github.com/HelixDB/helix-go This shell script provides the commands to install the HelixCLI tool by downloading and executing an installation script from the official HelixDB website. Following the installation, it initializes the HelixDB environment, preparing it for use. ```shell curl -sSL "https://install.helix-db.com" | bash helix install helix init ``` -------------------------------- ### Install Helix-DB using cURL and Bash Source: https://github.com/HelixDB/helix-py This shell command sequence downloads and executes the Helix-DB installation script from the official domain, followed by a command to finalize the installation. It's a common and straightforward method for quick setup on Unix-like systems. ```shell curl -sSL "https://install.helix-db.com" | bash helix install ``` -------------------------------- ### Initialize HelixDB Client and Perform Queries in TypeScript Source: https://github.com/HelixDB/helix-ts This snippet demonstrates how to set up a HelixDB client instance and execute database queries. It shows an example of adding a user with 'addUser' and then retrieving that user with 'getUser', logging the result to the console. The client can connect to a local or remote HelixDB instance. ```typescript const url = "https://us-west-1.amazonaws.com/v1"; const client = new HelixDB(url = "https://localhost:6969"); // Query the database await client.query("addUser", { name: "John", age: 20 }); // Get the user const user = await client.query("getUser", { name: "John" }); console.log(user); ``` -------------------------------- ### Install HelixCLI using curl Source: https://context7_llms This command downloads and executes the HelixCLI installation script from the official HelixDB server. It's the primary method for initial setup of the command-line interface. ```bash curl -sSL https://install.helix-db.com | bash ``` -------------------------------- ### Install HelixDB TypeScript Client Source: https://github.com/HelixDB/helix-ts This snippet provides the command-line instruction to install the `helix-ts` npm package. This package is the official TypeScript client library for interacting with HelixDB, and its installation is a necessary first step for developing applications that use HelixDB in a TypeScript environment. ```Shell $ npm install helix-ts ``` -------------------------------- ### Install HelixTS TypeScript Library Source: https://github.com/HelixDB/helix-ts Command to install the HelixTS npm package, which provides the TypeScript client for interacting with HelixDB from your Node.js or browser applications. ```Bash npm install helix-ts ``` -------------------------------- ### Manage HelixDB Instance Lifecycle Source: https://github.com/HelixDB/helix-py This Python example shows how to set up a `helix.instance.Instance` object. This class automatically manages the lifecycle of a HelixDB instance, starting and stopping it in conjunction with the program's execution, and interfacing with a specified `helixdb-cfg` directory. ```Python from helix.instance import Instance helix_instance = Instance("helixdb-cfg") ``` -------------------------------- ### Install helix-go client library Source: https://github.com/HelixDB/helix-go This snippet demonstrates how to install the `helix-go` client library using the Go package manager. This command fetches the library from GitHub and makes it available for use in Go projects. ```Shell go get github.com/HelixDB/helix-go ``` -------------------------------- ### Install and Initialize HelixDB CLI Source: https://github.com/HelixDB/helix-go Commands to download and install the HelixDB Command Line Interface (CLI) tool, followed by initialization steps to set up the local HelixDB environment. ```Shell curl -sSL "https://install.helix-db.com" | bash helix install helix init ``` -------------------------------- ### Install HelixDB CLI and Initialize Project Source: https://context7_llms This snippet provides the necessary bash commands to install the HelixDB command-line interface (CLI), install the Helix container, and initialize a new HelixDB project. These steps are prerequisites for developing applications with HelixDB. ```bash curl -sSL https://helix.sh/install.sh | bash ``` ```bash helix install ``` ```bash helix init ``` -------------------------------- ### Define HelixQL Queries for User Management Source: https://github.com/HelixDB/helix-ts Examples of defining HelixQL queries for common database operations: adding a new user and retrieving a user by name. These queries specify the data structure and logic for interacting with HelixDB. ```HelixQL QUERY addUser(name: String, age: Integer) => user <- AddN user <- N - Description: Initializes a new HelixDB project at the specified directory path. - Parameters: - --path : The directory where the new HelixDB project will be created. helix check - Description: Compiles and validates the queries defined in the current HelixDB project, ensuring they are syntactically correct and ready for deployment. helix deploy - Description: Deploys the compiled queries from the current HelixDB project, making them available for execution. helix instances - Description: Lists all currently running local HelixDB instances, showing their IDs and other relevant information. helix stop - Description: Stops a specific local HelixDB instance identified by its unique ID. - Parameters: - : The ID of the HelixDB instance to stop. helix stop --all - Description: Stops all currently running local HelixDB instances. ``` -------------------------------- ### Install HelixCLI Source: https://context7_llms This command downloads and executes the HelixCLI installation script from the official HelixDB website, setting up the command-line interface for HelixDB. ```bash curl -sSL https://install.helix-db.com | bash ``` -------------------------------- ### Install HelixDB Go SDK Source: https://github.com/HelixDB/helix-go Go command to fetch and install the official HelixDB Go SDK package. This command adds the necessary dependencies to your Go project, enabling interaction with HelixDB from Go applications. ```Go go get github.com/HelixDB/helix-go ``` -------------------------------- ### Install HelixDB Container Source: https://context7_llms These commands install the HelixDB container. The first command installs the stable version, while the second installs the development version, useful for testing new features or contributing to the project. ```bash helix install ``` ```bash helix install --dev ``` -------------------------------- ### TypeScript: Client Setup Source: https://context7_llms Demonstrates how to import and initialize the HelixDB client in TypeScript, specifying a custom URL for the HelixDB instance. ```TypeScript import HelixDB from "helix-ts"; // Create a new HelixDB client const client = new HelixDB("https://localhost:6969"); ``` -------------------------------- ### Install Helix DB Components Source: https://github.com/HelixDB/helix-db After successfully installing the Helix CLI tool, this command is used to install the core Helix DB components. It prepares your local environment for developing and deploying Helix DB applications. ```shell helix install ``` -------------------------------- ### Install HelixDB CLI Source: https://github.com/HelixDB/helix-db Installs the HelixDB Command Line Interface (CLI) tool by downloading and executing an installation script via curl. ```bash curl -sSL "https://install.helix-db.com" | bash ``` -------------------------------- ### Deploy HelixQL Queries Locally Source: https://github.com/HelixDB/helix-ts Command to deploy the defined HelixQL queries to your local HelixDB instance, making them available for execution through the HelixTS client. ```Bash helix deploy --local ``` -------------------------------- ### Install Helix-py SDK Source: https://context7_llms Instructions for installing the HelixDB Python SDK using either 'uv' or 'pip' package managers. ```bash uv add helix-py ``` ```bash pip install helix-py ``` -------------------------------- ### TypeScript: SDK Installation Source: https://context7_llms Instructions for installing the `helix-ts` TypeScript SDK using npm. ```Bash npm install helix-ts ``` -------------------------------- ### Setting Up Python Environment for HelixDB Source: https://context7_llms This section provides commands to set up a Python virtual environment and install the necessary libraries for interacting with HelixDB and for embedding text. It includes instructions for both `pip` and `uv` package managers. ```bash python -m venv venv source venv/bin/activate pip install helix-py sentence-transformers ``` ```bash uv venv uv add helix-py sentence-transformers ``` -------------------------------- ### Deploy HelixQL Queries Locally Source: https://github.com/HelixDB/helix-ts This command deploys HelixQL queries to a local environment. It is used for testing and development purposes, allowing immediate execution of defined queries. ```shell $ helix deploy --local ``` -------------------------------- ### Install HelixDB Container Source: https://context7_llms This command installs the HelixDB container, which is the core component of the HelixDB instance, necessary for running the database. ```bash helix install ``` -------------------------------- ### Install Helix CLI Tool Source: https://github.com/HelixDB/helix-db This command downloads and executes the Helix CLI installation script from the official Helix DB website. It's the first step to set up the Helix command-line interface on your system, enabling further interactions with Helix DB. ```shell curl -sSL "https://install.helix-db.com" | bash ``` -------------------------------- ### Interact with HelixDB using TypeScript Client Source: https://github.com/HelixDB/helix-ts Demonstrates how to initialize the HelixDB client in a TypeScript application, connect to a HelixDB instance, and execute previously defined HelixQL queries like 'addUser' and 'getUser' to perform database operations. ```TypeScript import HelixDB from "helix-ts"; // Create a new HelixDB client // The default url is http://localhost:6969 // EXAMPLE: const client = new HelixDB("https://xxxxxxxxxx.execute-api.us-west-1.amazonaws.com/v1"); const client = new HelixDB(url = "https://localhost:6969"); // Query the database await client.query("addUser", { name: "John", age: 20 }); // Get the user const user = await client.query("getUser", { name: "John" }); console.log(user); ``` -------------------------------- ### Define HelixQL Queries for User Management Source: https://github.com/HelixDB/helix-go Examples of HelixQL queries for common user management operations. This includes a `create_user` query to add new user records and a `get_users` query to retrieve all existing user records from the database. ```HelixQL // ./helixdb-cfg/queries.hx QUERY create_user(name: String, age: U32, email: String, now: I32) => user <- AddN({name: name, age: age, email: email, created_at: now, updated_at: now}) RETURN user QUERY get_users() => users <- N RETURN users ``` -------------------------------- ### Install HelixDB SDKs Source: https://context7_llms These commands install the HelixDB Software Development Kits for various programming languages, enabling programmatic interaction with HelixDB from applications written in Python, TypeScript, Go, or Rust. ```Python pip install helix-py ``` ```TypeScript npm install helix-ts ``` ```Go go get github.com/HelixDB/helix-go ``` ```Rust cargo add helix-db ``` -------------------------------- ### Install HelixDB Rust SDK Source: https://github.com/HelixDB/helix-rs Add the `helix-db` crate to your `Cargo.toml` file under the `[dependencies]` section to include the SDK in your Rust project. This makes the `helix-rs` functionalities available for use. ```TOML [dependencies] helix-db= "0.1.0" ``` -------------------------------- ### Install helix-py Python Library and Helix CLI Source: https://github.com/HelixDB/helix-py Instructions for installing the helix-py Python package using `uv` or `pip`, and the Helix command-line interface (CLI) using a curl script. The CLI is essential for managing helix-db instances. ```Shell uv add helix-py ``` ```Shell pip install helix-py ``` ```Shell curl -sSL "https://install.helix-db.com" | bash helix install ``` -------------------------------- ### Rust: SDK Installation Source: https://context7_llms Instructions for adding the `helix-db` Rust SDK to a project using Cargo, either via the command-line interface or by manually adding the dependency to `Cargo.toml`. ```Bash cargo add helix-db ``` ```TOML [dependencies] helix-db = "0.1.3" ``` -------------------------------- ### Installing HelixDB MCP Server Dependencies with `uv` Source: https://context7_llms Creates a Python virtual environment using `uv venv`, activates it, and then installs the `helix-py` package along with its `mcp[cli]` extra dependencies. This ensures all necessary components for the MCP server are available. ```bash uv venv && source .venv/bin/activate uv add helix-py "mcp[cli]" ``` -------------------------------- ### Python: Execute a Query Source: https://context7_llms Demonstrates a basic query execution using the HelixDB Python client, showing how to add a user with specified attributes. This is a conceptual example of how queries are structured. ```Python db.query(add_user("John", 20)) ``` -------------------------------- ### Verify HelixCLI Installation Source: https://context7_llms This command checks the installed version of HelixCLI to confirm successful installation and proper setup of the command-line tool. ```bash helix --version ``` -------------------------------- ### Setting Up `uv` Project for HelixDB MCP Server Source: https://context7_llms Initializes a new project directory using `uv init`, copies the downloaded `mcp_server.py` script into it, and then changes the current directory to the newly created project. This prepares the environment for dependency installation. ```bash uv init project cp mcp_server.py project cd project ``` -------------------------------- ### Go Client Example for HelixDB Interaction Source: https://github.com/HelixDB/helix-go A comprehensive Go program demonstrating how to connect to HelixDB using the `helix-go` SDK. It includes defining Go structs for user data and query responses, creating a new user, and retrieving users, showcasing different methods to scan query results. ```Go // ./main.go var HelixClient *helix.Client // Create user struct type User struct { Name string Age int32 Email string CreatedAt int32 `json:"created_at"` UpdatedAt int32 `json:"updated_at"` } // Create a type struct for the "get_users" query type GetUsersResponse struct { Users []User `json:"users"` } // Create a type struct for the "create_users" query type CreateUserResponse struct { User []User `json:"user"` } func main() { // Connect to client HelixClient = helix.NewClient("http://localhost:6969") // Create user data now := time.Now() timestamp := now.Unix() timestamp32 := int32(timestamp) newUser := map[string]any{ "name": "John", "age": 21, "email": "johndoe@email.com", "now": timestamp32, } // Create user in Helix var createdUser CreateUserResponse err := HelixClient.Query( "create_user", helix.WithData(newUser), ).Scan(&createdUser) if err != nil { log.Fatalf("Error while creating user: %s", err) } fmt.Println(createdUser) // Get all users and put Helix's response in GetUsersResponse var getUsersResponse GetUsersResponse err = HelixClient.Query("get_users").Scan(&getUsersResponse) if err != nil { log.Fatalf("Error while getting users: %s", err) } fmt.Println(getUsersResponse) // Get all users and put "users" from Helix's response in the `users` variable var users []User err = HelixClient.Query("get_users").Scan( helix.WithDest("users", &users), ) if err != nil { log.Fatalf("Error while getting users: %s", err) } fmt.Println(users) // Get all users in go's `map` data type usersMap, err := HelixClient.Query("get_users").AsMap() if err != nil { log.Fatalf("Error while getting users: %s", err) } fmt.Println(usersMap["users"]) } ``` -------------------------------- ### JavaScript Initial Function Calling Example Source: https://ai.google.dev/gemini-api/docs/function-calling This snippet demonstrates a basic setup for function calling in JavaScript, defining simple light control schemas and integrating them into a `run` function call with a prompt and tool configurations. ```JavaScript const turnOnTheLightsSchema = { name: 'turn_on_the_lights' }; const turnOffTheLightsSchema = { name: 'turn_off_the_lights' }; const prompt = ` Hey, can you write run some python code to turn on the lights, wait 10s and then turn off the lights? `; const tools = [ { codeExecution: {} }, { functionDeclarations: [turnOnTheLightsSchema, turnOffTheLightsSchema] } ]; await run(prompt, tools=tools, modality="AUDIO") ``` -------------------------------- ### Initialize HelixDB Project Source: https://context7_llms This snippet provides the basic shell commands to set up a new HelixDB project. It involves creating a directory, navigating into it, and running the HelixDB initialization command. ```bash mkdir professor_example cd professor_example helix init ``` -------------------------------- ### Initialize HelixDB Client and Prepare User Data in Go Source: https://github.com/HelixDB/helix-go This code demonstrates how to initialize the HelixDB client by connecting to a specified endpoint. It also shows the preparation of new user data as a Go map, including the calculation of current timestamps for `CreatedAt` and `UpdatedAt` fields, which are common for database record management. ```Go func main() { // Connect to client HelixClient = helix.NewClient("http://localhost:6969") // Create user data now := time.Now() timestamp := now.Unix() timestamp32 := int32(timestamp) newUser := map[string]any{ "name": "John", "age": 21, "email": "johndoe@email.com", "created_at": timestamp32, "updated_at": timestamp32 } ``` -------------------------------- ### Send requests to HelixDB using Go client Source: https://github.com/HelixDB/helix-go This comprehensive Go example illustrates how to connect to a HelixDB instance, define data structures for users, create a new user record, and retrieve existing user data. It showcases the use of `helix.NewClient` for connection, `HelixClient.Query` for executing database operations, and `Scan` for mapping responses to Go structs. ```Go // ./main.go var HelixClient *helix.Client // Create user struct type User struct { Name string Age int32 Email string CreatedAt int32 `json:"created_at"` UpdatedAt int32 `json:"updated_at"` } // Create a type struct for the "get_users" query type GetUsersResponse struct { Users []User `json:"users"` } // Create a type struct for the "create_users" query type CreateUserResponse struct { User []User `json:"user"` } func main() { // Connect to client HelixClient = helix.NewClient("http://localhost:6969") // Create user data now := time.Now() timestamp := now.Unix() timestamp32 := int32(timestamp) newUser := map[string]any{ "name": "John", "age": 21, "email": "johndoe@email.com", "now": timestamp32, } // Create user in Helix var createdUser CreateUserResponse err := HelixClient.Query( "create_user", helix.WithData(newUser), ).Scan(&createdUser) if err != nil { log.Fatalf("Error while creating user: %s", err) } fmt.Println(createdUser) // Get all users and put Helix's response in GetUsersResponse var getUsersResponse GetUsersResponse err = HelixClient.Query("get_users").Scan(&getUsersResponse) if err != nil { log.Fatalf("Error while getting users: %s", err) } fmt.Println(getUsersResponse) // Get all users and put "users" from Helix's response in the `users` variable var users []User err = HelixClient.Query("get_users").Scan( helix.WithDest("users", &users), ) if err != nil { log.Fatalf("Error while getting users: %s" ``` -------------------------------- ### Initialize New HelixDB Project Source: https://context7_llms This command sets up a new HelixDB project, creating a configuration directory at the specified path (`helixdb-cfg`) to store schema and query files. ```bash helix init --path helixdb-cfg ``` -------------------------------- ### Initialize HelixDB Go Client Source: https://context7_llms This Go code snippet demonstrates how to import the HelixDB Go SDK and initialize a new client instance. The client connects to a running HelixDB instance, typically at a specified URL like `http://localhost:6969`, enabling interaction with the database. ```go import "github.com/HelixDB/helix-go" // Create a new HelixDB client var helixClient *helix.Client helixClient = helix.NewClient("http://localhost:6969") ``` -------------------------------- ### Install helix-py Python Library Source: https://github.com/HelixDB/helix-py Instructions for installing the helix-py Python library, which serves as an interface for the helix-db graph-vector database. The library can be installed using either the uv package manager or the traditional pip package installer. ```Shell uv add helix-py ``` ```Shell pip install helix-py ``` -------------------------------- ### Initialize New HelixDB Project Source: https://context7_llms This command sets up a new HelixDB project directory at the specified path. It creates the necessary configuration files and project structure for defining schemas and queries. ```bash helix init --path helixdb-cfg ``` -------------------------------- ### Initialize a New Helix Project Source: https://github.com/HelixDB/helix-db This command initializes a new Helix project at a specified path. It sets up the necessary project structure and configuration files, making the directory ready for defining Helix DB schemas and writing queries. ```shell helix init --path ``` -------------------------------- ### Set Up Helix MCP Server Environment with uv Source: https://github.com/HelixDB/helix-py These shell commands illustrate the steps to set up a development environment for the Helix MCP server using `uv`. It covers project initialization, copying the server script, creating a virtual environment, activating it, and installing necessary dependencies. ```shell uv init project cp mcp_server.py project cd project uv venv && source .venv/bin/activate uv add helix-py "mcp[cli]" ``` -------------------------------- ### Verify HelixCLI Installation Source: https://context7_llms This command checks the installed version of HelixCLI, confirming that the installation was successful and the `helix` command is accessible in your system's PATH. ```bash helix --version ``` -------------------------------- ### Automatic Function Calling with Gemini for Smart Home Control Source: https://ai.google.dev/gemini-api/docs/function-calling This Python example demonstrates how to configure the Google Gemini API to automatically call user-defined functions for controlling smart home devices. It shows how to define functions for powering a disco ball, starting music, and dimming lights, then passes them to the Gemini model for invocation based on a natural language prompt. ```Python from google import genai from google.genai import types # Actual function implementations def power_disco_ball_impl(power: bool) -> dict: """Powers the spinning disco ball. Args: power: Whether to turn the disco ball on or off. Returns: A status dictionary indicating the current state. """ return {"status": f"Disco ball powered {'on' if power else 'off'}"} def start_music_impl(energetic: bool, loud: bool) -> dict: """Play some music matching the specified parameters. Args: energetic: Whether the music is energetic or not. loud: Whether the music is loud or not. Returns: A dictionary containing the music settings. """ music_type = "energetic" if energetic else "chill" volume = "loud" if loud else "quiet" return {"music_type": music_type, "volume": volume} def dim_lights_impl(brightness: float) -> dict: """Dim the lights. Args: brightness: The brightness of the lights, 0.0 is off, 1.0 is full. Returns: A dictionary containing the new brightness setting. """ return {"brightness": brightness} # Configure the client client = genai.Client() config = types.GenerateContentConfig( tools=[power_disco_ball_impl, start_music_impl, dim_lights_impl] ) # Make the request response = client.models.generate_content( model="gemini-2.5-flash", contents="Do everything you need to this place into party!", config=config, ) print("\nExample 2: Automatic function calling") print(response.text) ``` -------------------------------- ### Sequential Function Calling with Gemini for Weather and Thermostat Control Source: https://ai.google.dev/gemini-api/docs/function-calling This Python example illustrates sequential function calling using the Google Gemini API. It demonstrates how the SDK can automatically chain multiple function calls (e.g., getting weather then setting a thermostat) based on a single complex natural language prompt, showcasing the model's ability to coordinate actions. ```Python import os from google import genai from google.genai import types # Example Functions def get_weather_forecast(location: str) -> dict: """Gets the current weather temperature for a given location.""" print(f"Tool Call: get_weather_forecast(location={location})") # TODO: Make API call print("Tool Response: {'temperature': 25, 'unit': 'celsius'}") return {"temperature": 25, "unit": "celsius"} # Dummy response def set_thermostat_temperature(temperature: int) -> dict: """Sets the thermostat to a desired temperature.""" print(f"Tool Call: set_thermostat_temperature(temperature={temperature})") # TODO: Interact with a thermostat API print("Tool Response: {'status': 'success'}") return {"status": "success"} # Configure the client and model client = genai.Client() config = types.GenerateContentConfig( tools=[get_weather_forecast, set_thermostat_temperature] ) # Make the request response = client.models.generate_content( model="gemini-2.5-flash", contents="If it's warmer than 20°C in London, set the thermostat to 20°C, otherwise set it to 18°C.", config=config, ) # Print the final, user-facing response print(response.text) ``` -------------------------------- ### Install HelixDB Client SDKs Source: https://context7_llms This snippet provides commands to install the HelixDB client SDKs for Python and TypeScript. These SDKs allow developers to interact with the HelixDB database from their respective programming languages. ```bash pip install helix-py ``` ```bash npm install helix-ts ``` -------------------------------- ### Interact with HelixDB using helix.Client Source: https://github.com/HelixDB/helix-py This example demonstrates how to set up a `helix.Client` to connect to a running HelixDB instance. It shows how to load data, build an HNSW index by inserting vectors, and perform similarity searches using predefined query functions like `hnswinsert` and `hnswsearch`. It also illustrates a simpler way to execute queries by name and parameters. ```Python import helix from helix.client import hnswinsert, hnswsearch db = helix.Client(local=True, verbose=True) data = helix.Loader("path/to/data", cols=["vecs"]) [db.query(hnswinsert(d)) for d in data] # build hnsw index my_query = [0.32, ..., -1.321] nearest = db.query(hnswsearch(my_query)) # query hnsw index ``` ```Python db.query("add_user", { "name", "John", "age": 34 }) ``` -------------------------------- ### Initializing HelixDB Client and Embedding Model Source: https://context7_llms This Python snippet demonstrates how to import the required libraries, initialize a `SentenceTransformer` model for creating embeddings (using 'Qwen/Qwen3-Embedding-0.6B'), and establish a connection to a local HelixDB instance. This setup is crucial for subsequent database operations and embedding-based searches. ```python import helix from sentence_transformers import SentenceTransformer model = SentenceTransformer("Qwen/Qwen3-Embedding-0.6B") db = helix.Client(local=True, port=6969, verbose=True) ``` -------------------------------- ### Helix-DB HQL RANGE Operation Source: https://context7_llms The `RANGE` operation allows you to retrieve a specific subset of elements from a traversal. The range is inclusive of the start index but exclusive of the end index. Both `start` and `end` parameters are required positive integers. ```APIDOC ::RANGE(start, end) - Description: Get a range of elements from a traversal. The range is inclusive of the start, but exclusive of the end (e.g., RANGE(0, 10) returns elements 0 through 9). - Parameters: - start: The starting index (inclusive), must be a positive integer. - end: The ending index (exclusive), must be a positive integer. ``` ```rust QUERY GetRange(start: U32, end: U32) => range <- N::RANGE(start, end) RETURN range ``` -------------------------------- ### Executing HelixDB Queries in Go Source: https://context7_llms This snippet demonstrates how to prepare data and execute 'create_user' and 'get_users' queries against HelixDB using the Go client. It shows how to pass data with 'helix.WithData' and scan responses into Go structs. ```go // Create user data now := time.Now() timestamp := now.Unix() timestamp32 := int32(timestamp) newUser := map[string]any{ "name": "John", "age": 21, "email": "johndoe@email.com", "now": timestamp32, } // Create user in Helix var createdUser CreateUserResponse err := HelixClient.Query( "create_user", helix.WithData(newUser), ).Scan(&createdUser) if err != nil { log.Fatalf("Error while creating user: %s", err) } fmt.Println("Created user:", createdUser) // Get all users and put Helix's response in GetUsersResponse var getUsersResponse GetUsersResponse err = HelixClient.Query("get_users").Scan(&getUsersResponse) if err != nil { log.Fatalf("Error while getting users: %s", err) } fmt.Println("Get users response:", getUsersResponse) ``` -------------------------------- ### Example Vector Search with Time-Based Postfiltering in HelixDB (Rust) Source: https://context7_llms Provides a concrete example of a HelixDB query that first performs a vector search for `Document` types. It then applies a postfilter using a `WHERE` clause to include only documents where the `created_at` timestamp is less than or equal to a given `now` timestamp. ```rust QUERY SearchVector (vector: [F64], now: I64) => documents <- SearchV(vector) documents <- documents::WHERE(_::{created_at}::LTE(now)) RETURN documents ```