### Setup Dependencies and Build OpenAI Computer Use Example (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/examples/openai-computer-use/README.md This snippet provides the necessary commands to set up the project environment. It includes installing dependencies using pnpm, building the project, and installing the required browser for Playwright. ```bash # Install dependencies pnpm install # Build the example pnpm build # Install Playwright npx playwright install ``` -------------------------------- ### Running GenSX Examples Source: https://github.com/gensx-inc/gensx/blob/main/examples/README.md This snippet provides general instructions for running GenSX examples. It outlines the steps to navigate into a specific example directory, install its dependencies using pnpm, and then start the development server for the example. ```bash # Navigate to the example directory cd examples/ # Install dependencies pnpm install # Run the example pnpm run dev ``` -------------------------------- ### Running a GenSX Example Project with pnpm in Bash Source: https://github.com/gensx-inc/gensx/blob/main/README.md This snippet provides the command-line instructions for running a GenSX example project. It involves navigating into the specific example directory, installing project dependencies using `pnpm install`, and then starting the application with `pnpm start`. This sequence is typical for setting up and executing Node.js-based projects. ```bash cd examples/ pnpm install pnpm start ``` -------------------------------- ### Build Example Projects (pnpm) Source: https://github.com/gensx-inc/gensx/blob/main/CONTRIBUTING.md Builds the example projects included in the repository. ```bash pnpm build:examples ``` -------------------------------- ### Setup and Run LLM Tic-Tac-Toe Example (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/examples/llm-games/README.md Provides the necessary bash commands to install project dependencies using pnpm, set the required OpenAI API key as an environment variable, and execute the main script to start the Tic-Tac-Toe tournament. ```bash # Install dependencies pnpm install # Set your OpenAI API key or any relevant key export OPENAI_API_KEY= # Run the example pnpm run start ``` -------------------------------- ### Lint Example Projects (pnpm) Source: https://github.com/gensx-inc/gensx/blob/main/CONTRIBUTING.md Runs the linter specifically on the example projects. ```bash pnpm lint:examples ``` -------------------------------- ### Running OpenAI Computer Use Example with Bash Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/examples/openai-computer-use.mdx This snippet provides the necessary bash commands to set up and execute the OpenAI computer-use example. It covers navigating to the project directory, installing dependencies with pnpm, installing Playwright browser binaries, and finally running the application by providing the OpenAI API key. ```bash # Navigate to the example directory cd examples/openai-computer-use # Install dependencies pnpm install # Install playwright npx playwright install # Run the example OPENAI_API_KEY= pnpm run start ``` -------------------------------- ### Build All Projects (pnpm) Source: https://github.com/gensx-inc/gensx/blob/main/CONTRIBUTING.md Builds all core packages and example projects. ```bash pnpm build:all ``` -------------------------------- ### Installing Project Dependencies (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/examples/text-to-sql/README.md Installs the necessary project dependencies using pnpm. Ensure pnpm is installed globally or available in your environment. ```bash pnpm install ``` -------------------------------- ### Starting the GenSX Local Development Server Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/quickstart.mdx This command starts the GenSX local development server, which automatically creates REST APIs for defined workflows. This allows for local testing and interaction with the workflows as if they were deployed to GenSX Cloud. ```bash gensx dev ``` -------------------------------- ### Installing Project Dependencies Source: https://github.com/gensx-inc/gensx/blob/main/examples/openai-examples/README.md This command installs all necessary project dependencies using pnpm, ensuring that the environment is set up correctly for running the GenSX workflows. ```bash pnpm install ``` -------------------------------- ### Running the Typescript Example (bash) Source: https://github.com/gensx-inc/gensx/blob/main/examples/typescript-compatibility/README.md This command executes the start script defined in the project's package.json, which is configured to build and run the Typescript example demonstrating compatibility with older configurations (`moduleResolution: "Node"`, `target: "es5"`). ```bash pnpm start ``` -------------------------------- ### Installing Project Dependencies (PNPM) Source: https://github.com/gensx-inc/gensx/blob/main/examples/vercel-ai/README.md This command installs all necessary project dependencies using PNPM, ensuring that the development environment is correctly set up for running the GenSX example. It's a standard step after cloning the repository to prepare the project. ```bash pnpm install ``` -------------------------------- ### Install Dependencies (pnpm) Source: https://github.com/gensx-inc/gensx/blob/main/CONTRIBUTING.md Installs all project dependencies using the pnpm package manager. ```bash pnpm install ``` -------------------------------- ### Running Blog Writer Example (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/examples/blog-writing.mdx This snippet provides the necessary bash commands to set up and run the Blog Writer example. It includes navigating to the project directory, installing dependencies, setting required API keys for Anthropic, Perplexity, and optional GenSX, and finally executing the workflow. ```bash # Navigate to the example directory cd examples/blog-writer # Install dependencies pnpm install # Set your API keys export ANTHROPIC_API_KEY= export PERPLEXITY_API_KEY= # Optional: For catalog search export GENSX_API_KEY= export GENSX_PROJECT= export GENSX_ENV=development # Run the example pnpm run start ``` -------------------------------- ### Installing GenSX CLI Globally using npm Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/quickstart.mdx This command installs the GenSX command-line interface globally using npm, allowing `gensx` commands to be run from any directory. It's a prerequisite for creating and managing GenSX projects. ```bash npm i -g gensx ``` -------------------------------- ### Installing GenSX Storage Package (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/quickstart.mdx This command installs the `@gensx/storage` package, which provides utilities for interacting with blob storage in GenSX applications. It is a prerequisite for using blob storage features. ```bash npm install @gensx/storage ``` -------------------------------- ### Installing Project Dependencies Source: https://github.com/gensx-inc/gensx/blob/main/examples/rag/README.md Installs the necessary project dependencies using the pnpm package manager. ```bash pnpm install ``` -------------------------------- ### Installing Project Dependencies Source: https://github.com/gensx-inc/gensx/blob/main/examples/reflection/README.md This command installs all necessary project dependencies defined in the `package.json` file using pnpm, ensuring the environment is set up to run the GenSX workflow. ```bash pnpm install ``` -------------------------------- ### Run OpenAI Computer Use Example (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/examples/openai-computer-use/README.md This snippet shows how to configure your OpenAI API key and execute the built example. You need to replace `` with your actual key. ```bash # Set your OpenAI API key export OPENAI_API_KEY= # Run the example pnpm run start ``` -------------------------------- ### Installing Dependencies with pnpm Source: https://github.com/gensx-inc/gensx/blob/main/examples/hacker-news-analyzer/README.md This command installs all necessary project dependencies using pnpm, a fast, disk-space efficient package manager. It is a prerequisite for running the GenSX Hacker News Analyzer workflow. ```bash pnpm install ``` -------------------------------- ### Installing Project Dependencies with pnpm - Bash Source: https://github.com/gensx-inc/gensx/blob/main/examples/open-router/README.md This command installs all necessary project dependencies using pnpm, a fast, disk-space efficient package manager. It ensures that all required libraries and modules for the GenSX workflow are available before execution or deployment. ```bash pnpm install ``` -------------------------------- ### Example API Request Log Trace Source: https://github.com/gensx-inc/gensx/blob/main/website/home/_posts/_logging.md This snippet shows an example of structured log output tracing a single API request flow, from start to completion, including headers, payload, and database interaction. ```Log Example 2024-03-15 10:15:23 INFO RequestStart: POST /api/data 2024-03-15 10:15:23 DEBUG Headers: {Authorization: Bearer ***, Content-Type: application/json} 2024-03-15 10:15:23 DEBUG Payload: {"user_id": "123", "action": "update"} 2024-03-15 10:15:24 INFO DatabaseQuery: Updated user record 2024-03-15 10:15:24 INFO RequestComplete: Status 200 (Duration: 127ms) ``` -------------------------------- ### Install Dependencies with pnpm Source: https://github.com/gensx-inc/gensx/blob/main/packages/gensx/CONTRIBUTING.md Installs all necessary project dependencies listed in the package.json file using the pnpm package manager. ```bash pnpm install ``` -------------------------------- ### Start Development Mode (pnpm) Source: https://github.com/gensx-inc/gensx/blob/main/CONTRIBUTING.md Starts development mode. Running from the root watches all core packages; running from a package directory watches only that package. ```bash pnpm dev ``` -------------------------------- ### Starting GenSX Development Server (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/quickstart.mdx This command initiates the GenSX development server, enabling hot reloading, exposing workflows as REST API endpoints, and providing a Swagger UI for interactive documentation. It also includes built-in support for local blob storage and databases, facilitating local development and testing of GenSX workflows. ```bash gensx start src/workflows.ts ``` -------------------------------- ### Installing Project Dependencies (pnpm) Source: https://github.com/gensx-inc/gensx/blob/main/examples/anthropic-examples/README.md This command uses pnpm to install all necessary project dependencies defined in the `package.json` file, preparing the environment for development or deployment. ```bash pnpm install ``` -------------------------------- ### Starting a New GenSX Project Workflow (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/cli-reference/index.mdx This sequence of commands guides a user through initiating a new GenSX project. It involves logging into GenSX Cloud, creating a new project directory, navigating into it, and then starting a local development server for the project's workflows. ```bash # Log in to GenSX Cloud gensx login # Create a new project gensx new my-project cd my-project # Start local development gensx start src/workflows.ts ``` -------------------------------- ### Running Hacker News Analyzer Example - Bash Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/examples/hn.mdx This snippet provides the necessary bash commands to set up and run the Hacker News Analyzer example. It includes navigating to the project directory, installing dependencies using pnpm, setting the OpenAI API key as an environment variable, and finally executing the development script. ```bash # Navigate to the example directory cd examples/hacker-news-analyzer # Install dependencies pnpm install # Set your OpenAI API key export OPENAI_API_KEY= # Run the example pnpm run dev ``` -------------------------------- ### Running Self-Modifying Code Agent Example (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/examples/self-modifying-code/README.md Provides the necessary bash commands to set up and run the self-modifying code agent. It includes installing dependencies using `pnpm install` and executing the agent with required environment variables like `ANTHROPIC_API_KEY`, `REPO_URL`, and `BRANCH`. ```bash # Install dependencies pnpm install # Run the example ANTHROPIC_API_KEY= REPO_URL=https://github.com// BRANCH= pnpm run start ``` -------------------------------- ### Installing Dependencies with pnpm - Bash Source: https://github.com/gensx-inc/gensx/blob/main/examples/groq-deepseek/README.md This command uses pnpm to install all project dependencies specified in the `package.json` file. It ensures that all necessary libraries and packages are available for the workflow to run correctly. ```bash pnpm install ``` -------------------------------- ### Starting GenSX server with a specific workflow file (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/cli-reference/start.mdx This example demonstrates how to launch the GenSX development server, explicitly pointing to `src/workflows.ts` as the workflow file to be served. This is the standard method for beginning local development and testing of a particular workflow. ```bash # Start server with a specific workflow file gensx start src/workflows.ts ``` -------------------------------- ### Starting Local API Server Source: https://github.com/gensx-inc/gensx/blob/main/examples/rag/README.md Starts a local HTTP API server that exposes the workflows for testing via API calls. ```bash pnpm start ``` -------------------------------- ### Starting Local GenSX API Server (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/examples/text-to-sql/README.md Starts a local HTTP API server that exposes the GenSX workflows. This allows testing the workflows via standard API calls using tools like curl or a browser. ```bash pnpm start ``` -------------------------------- ### Installing Dependencies with npm Source: https://github.com/gensx-inc/gensx/blob/main/examples/salty-ocean-model-comparison/README.md Installs the necessary project dependencies listed in the package.json file using the npm package manager. ```bash npm install ``` -------------------------------- ### Starting Local API Server Source: https://github.com/gensx-inc/gensx/blob/main/examples/openai-examples/README.md This command starts a local API server, allowing workflows to be accessed and tested via HTTP requests, typically on port 1337. ```bash pnpm start ``` -------------------------------- ### Example Logging Configuration File (JSON) Source: https://github.com/gensx-inc/gensx/blob/main/website/home/_posts/_logging.md Provides a sample JSON configuration file structure for setting up a logging system, specifying the default log level, format, output destinations (console, file), and file-specific settings like path and rotation policy. ```json { "logging": { "level": "debug", "format": "json", "outputs": ["console", "file"], "file": { "path": "./logs/app.log", "rotation": "10MB" } } } ``` -------------------------------- ### Starting Local API Server (pnpm) Source: https://github.com/gensx-inc/gensx/blob/main/examples/anthropic-examples/README.md This command starts a local API server, allowing workflows to be tested via HTTP requests, typically accessible at `http://localhost:1337`. ```bash pnpm start ``` -------------------------------- ### Starting Local GenSX API Server - Bash Source: https://github.com/gensx-inc/gensx/blob/main/examples/groq-deepseek/README.md This command starts a local API server for the GenSX workflow, making it accessible via HTTP requests. It enables testing the workflow through its API endpoints, simulating a production environment. ```bash pnpm run start ``` -------------------------------- ### GenSX Development Server Output (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/quickstart.mdx This snippet shows the expected console output when the GenSX development server successfully starts. It indicates the server's running URL, the Swagger UI endpoint, and lists the available workflow APIs, confirming the server is listening for changes and ready for requests. ```bash ๐Ÿš€ GenSX Dev Server running at http://localhost:1337 ๐Ÿงช Swagger UI available at http://localhost:1337/swagger-ui Available workflows: - ChatWorkflow: http://localhost:1337/workflows/ChatWorkflow Listening for changes... 10:58:55 AM ``` -------------------------------- ### Installing Project Dependencies (pnpm) Source: https://github.com/gensx-inc/gensx/blob/main/examples/deep-research/README.md This command installs all required project dependencies using pnpm, a fast, disk-space efficient package manager. It ensures that all necessary libraries and modules for the Deep Research workflow are available before execution or deployment. ```bash pnpm install ``` -------------------------------- ### Starting Development Server with npm Source: https://github.com/gensx-inc/gensx/blob/main/examples/salty-ocean-model-comparison/README.md Executes the 'dev' script defined in the package.json file, typically used to start the application's development server. ```bash npm run dev ``` -------------------------------- ### Starting Local GenSX API Server with pnpm - Bash Source: https://github.com/gensx-inc/gensx/blob/main/examples/open-router/README.md This command starts a local API server for the GenSX workflow, allowing it to be accessed via HTTP requests. This is useful for integrating the workflow with other local applications or for testing API endpoints. ```bash pnpm run start ``` -------------------------------- ### Running Development Server with Next.js (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/website/home/README.md This snippet shows how to start the Next.js development server locally using different Node.js package managers. Running this command makes the application accessible in a web browser, typically at http://localhost:3000, for local development and testing. ```bash npm run dev # or yarn dev # or pnpm dev # or bun dev ``` -------------------------------- ### Example of Getting a Database Instance (TSX) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/component-reference/storage-components/database-reference.mdx Demonstrates how to use `dbClient.getDatabase` to obtain a database instance and then execute a SQL query against it. ```tsx const db = await dbClient.getDatabase("users"); const results = await db.execute("SELECT * FROM users LIMIT 10"); ``` -------------------------------- ### Example of Listing Databases (TSX) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/component-reference/storage-components/database-reference.mdx Demonstrates how to call `dbClient.listDatabases` to get a list of database names and an optional `nextCursor` for pagination, then logs the available databases. ```tsx const { databases, nextCursor } = await dbClient.listDatabases(); console.log("Available databases:", databases); // ["users", "products", "analytics"] ``` -------------------------------- ### Installing Project Dependencies (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/examples/chat-memory/README.md Installs the necessary project dependencies listed in the package.json file using the pnpm package manager. This includes GenSX core, OpenAI, and storage libraries. ```bash pnpm install ``` -------------------------------- ### Starting Local API Server (pnpm) Source: https://github.com/gensx-inc/gensx/blob/main/examples/deep-research/README.md This command starts a local API server, enabling the DeepResearch workflow to be tested via HTTP requests. It provides an endpoint for interacting with the workflow as if it were a deployed service. ```bash pnpm start ``` -------------------------------- ### Starting Local GenSX API Server (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/examples/chat-memory/README.md Starts a local HTTP API server that exposes the GenSX workflow. This allows testing the workflow via standard API calls using tools like curl or HTTP clients. ```bash pnpm start ``` -------------------------------- ### Installing Project Dependencies (NPM) Source: https://github.com/gensx-inc/gensx/blob/main/examples/blog-writer/README.md This command installs all necessary Node.js dependencies for the project, as defined in the `package.json` file. It's a standard step to set up the development environment after cloning the repository. ```bash npm install ``` -------------------------------- ### Starting Local GenSX API Server Source: https://github.com/gensx-inc/gensx/blob/main/examples/hacker-news-analyzer/README.md This command initiates a local API server for the GenSX workflow, allowing it to be tested via HTTP requests. A Swagger UI is also made available for API details and testing. ```bash pnpm start ``` -------------------------------- ### Running GenSX Workflow from CLI (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/quickstart.mdx This snippet demonstrates how to execute a deployed GenSX workflow directly from the command line. It shows two examples: synchronously running a workflow with a JSON input, and running a workflow while saving its output to a specified file. This functionality is useful for testing and integrating workflows into scripts. ```bash # Run a workflow synchronously gensx run ChatWorkflow --input '{"userMessage":"Write a poem about an AI loving raccoon"}' # Save the output to a file gensx run ChatWorkflow --input '{"userMessage":"Write a haiku"}' --output result.json ``` -------------------------------- ### Installing @gensx/openai Package Source: https://github.com/gensx-inc/gensx/blob/main/packages/gensx-openai/README.md This command installs the `@gensx/openai` package along with the official `openai` SDK using npm. It is the first step required to set up the GenSX-wrapped OpenAI client in your project. ```bash npm install @gensx/openai openai ``` -------------------------------- ### Running GenSX Workflow Locally (Development) - Bash Source: https://github.com/gensx-inc/gensx/blob/main/examples/groq-deepseek/README.md This command starts the GenSX workflow in development mode locally, allowing for direct testing and debugging of the workflow logic without deploying it to the cloud or starting an API server. ```bash pnpm run dev ``` -------------------------------- ### Example of Initializing SearchClient in TypeScript Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/component-reference/storage-components/search-reference.mdx Demonstrates how to instantiate the `SearchClient` class, both with default options and with custom configuration for `project` and `environment`. ```tsx // Default client const searchClient = new SearchClient(); // With configuration const searchClient = new SearchClient({ project: "my-project", environment: "production", }); ``` -------------------------------- ### Setting Environment Variables for API Keys Source: https://github.com/gensx-inc/gensx/blob/main/examples/salty-ocean-model-comparison/README.md Example content for a .env file to configure API keys required for accessing the OpenAI and Groq providers. ```bash OPENAI_API_KEY=your_openai_api_key GROQ_API_KEY=your_groq_api_key ``` -------------------------------- ### Run Windsurf Rules CLI After Installation (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/packages/gensx-windsurf-rules/README.md After installing the package as a dependency, this command executes the gensx-windsurf-rules CLI to install the .windsurfrules file. ```bash npx gensx-windsurf-rules ``` -------------------------------- ### Creating a New GenSX Project Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/quickstart.mdx This command creates a new GenSX project with a specified name, initializing it with a basic workflow template. It prompts the user to select IDE rules for better AI assistant integration. ```bash gensx new ``` -------------------------------- ### Watch for Changes with pnpm Source: https://github.com/gensx-inc/gensx/blob/main/packages/gensx/CONTRIBUTING.md Starts a development process that watches for file changes and automatically rebuilds the project, facilitating rapid iteration. ```bash pnpm dev ``` -------------------------------- ### Creating a New GenSX Project (Shell) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/cloud/index.mdx This command initializes a new GenSX project named `my-project`. It sets up the necessary project structure and configuration files, providing a starting point for developing AI agents and workflows. This is typically the second step after installing the CLI. ```Shell gensx new my-project ``` -------------------------------- ### Logging In to GenSX Cloud Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/quickstart.mdx This command initiates the login process for GenSX Cloud, redirecting the user to the GenSX website for authentication. It's optional but recommended for visualizing workflows and viewing traces. ```bash gensx login ``` -------------------------------- ### Running GenSX Workflow Locally Source: https://github.com/gensx-inc/gensx/blob/main/examples/hacker-news-analyzer/README.md This command starts the GenSX workflow locally, performing the full sequence of fetching Hacker News posts, analyzing content, and generating output files (hn_analysis_report.md and hn_analysis_tweet.txt). ```bash pnpm run start ``` -------------------------------- ### Deploying GenSX Project to Production (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/quickstart.mdx This command extends the deployment process to target a specific environment, such as 'production', using the `--env` flag. It performs the same build, bundling, and upload steps as a standard deployment, ensuring the project is deployed to the designated production infrastructure with the specified environment variables. ```bash # Deploy to production environment gensx deploy src/workflows.ts -e OPENAI_API_KEY --env production ``` -------------------------------- ### Installing @gensx/storage with npm Source: https://github.com/gensx-inc/gensx/blob/main/packages/gensx-storage/README.md This snippet demonstrates how to install the `@gensx/storage` library using the npm package manager. This is the first step to integrate storage functionalities into a GenSX project. ```bash npm install @gensx/storage ``` -------------------------------- ### Installing GenSX CLI (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/cli-reference/index.mdx This command installs the GenSX command-line interface globally using npm. It makes the `gensx` command available system-wide for managing GenSX applications. ```bash npm install -g gensx ``` -------------------------------- ### Deploying Workflow to GenSX Cloud Source: https://github.com/gensx-inc/gensx/blob/main/examples/rag/README.md Deploys the project's workflows to the GenSX Cloud environment for execution. ```bash pnpm run deploy ``` -------------------------------- ### Installing @gensx/storage Package (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/component-reference/storage-components/search-reference.mdx This snippet demonstrates how to install the `@gensx/storage` npm package using the npm package manager. This package provides access to GenSX Cloud search components. ```bash npm install @gensx/storage ``` -------------------------------- ### Run CLAUDE.md CLI After Installation - Bash Source: https://github.com/gensx-inc/gensx/blob/main/packages/gensx-claude-md/README.md Execute the gensx-claude-md command-line interface using npx after the package has been installed as a dependency in the project. ```bash npx gensx-claude-md ``` -------------------------------- ### Installing Cursor Rules Directly with npx (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/packages/gensx-cursor-rules/README.md This command directly executes the `@gensx/cursor-rules` package using `npx`, allowing for immediate installation and execution of the rules without adding the package as a project dependency. It's suitable for one-off or quick installations. ```bash npx @gensx/cursor-rules ``` -------------------------------- ### Examples of gensx run Command Usage (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/cli-reference/run.mdx This section provides practical examples demonstrating how to use the `gensx run` command with various options. It shows how to run a workflow with no input, provide JSON input, specify a project and environment, execute asynchronously, and save the workflow's output to a file. ```bash # Run a workflow with no input gensx run MyWorkflow # Run a workflow with JSON input gensx run MyWorkflow --input '{"text": "Hello, world!"}' # Run a workflow in a specific project and environment gensx run MyWorkflow --project my-project --env prod # Run a workflow asynchronously (don't wait for completion) gensx run MyWorkflow --no-wait # Run a workflow and save output to a file gensx run MyWorkflow --output result.json ``` -------------------------------- ### Installing GenSX Storage Package (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/cloud/storage/search.mdx This command installs the `@gensx/storage` npm package, which provides access to GenSX's search service functionalities, including hooks for interacting with search namespaces. ```bash npm install @gensx/storage ``` -------------------------------- ### Build Core Packages (pnpm) Source: https://github.com/gensx-inc/gensx/blob/main/CONTRIBUTING.md Builds the core library packages of the project. ```bash pnpm build ``` -------------------------------- ### Using gensx start command syntax (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/cli-reference/start.mdx This snippet outlines the fundamental command-line syntax for initiating the GenSX development server. It specifies that a workflow file is a required argument, followed by optional parameters to customize server behavior. ```bash gensx start [options] ``` -------------------------------- ### Installing GenSX Storage Package (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/component-reference/storage-components/database-reference.mdx This snippet demonstrates how to install the `@gensx/storage` package using npm, which provides access to GenSX Cloud SQL database components. This is the first step to integrate GenSX database functionalities into your project. ```bash npm install @gensx/storage ``` -------------------------------- ### Installing GenSX CLI (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/packages/gensx/README.md Instructions for installing the GenSX CLI globally using npm, pnpm, yarn, or Homebrew. Choose one method based on your preferred package manager. ```bash npm install -g gensx # or pnpm install -g gensx # or yarn global add gensx # or brew install gensx-inc/gensx/gensx ``` -------------------------------- ### Running GenSX InitializeDatabase Workflow in Cloud (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/examples/text-to-sql/README.md Executes the `InitializeDatabase` workflow in the GenSX Cloud. This workflow sets up the necessary database schema and populates it with data. ```bash gensx run InitializeDatabase ``` -------------------------------- ### Logging in to GenSX Cloud Source: https://github.com/gensx-inc/gensx/blob/main/examples/rag/README.md Authenticates the user with the GenSX Cloud platform using the GenSX command-line interface. ```bash npx gensx login ``` -------------------------------- ### Deploying and Running GenSX Chat Workflow (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/quickstart.mdx These bash commands demonstrate how to deploy and run the GenSX chat workflow. `gensx deploy` deploys the workflow, requiring an `OPENAI_API_KEY`. `gensx run` executes the `ChatWorkflow` with specified `userMessage` and `threadId` inputs, showing how to interact with the chat history feature across multiple calls to the same thread. ```bash gensx deploy src/workflows.ts -e OPENAI_API_KEY # send an initial message to the thead gensx run ChatWorkflow --input '{"userMessage":"Name the capital of France", "threadId":"123"}' # use the same thread gensx run ChatWorkflow --input '{"userMessage":"What was my previous message?", "threadId":"123"}' ``` -------------------------------- ### Deploying GenSX Project to Cloud (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/quickstart.mdx This command deploys the GenSX project to GenSX Cloud, bundling TypeScript code and dependencies for production. It creates serverless REST API endpoints for each workflow and configures the necessary infrastructure. The `-e OPENAI_API_KEY` flag ensures the specified environment variable is passed during deployment. ```bash # Deploy your project to GenSX Cloud gensx deploy src/workflows.ts -e OPENAI_API_KEY ``` -------------------------------- ### Installing GenSX Storage Package (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/cloud/storage/sql-database.mdx This snippet demonstrates how to install the `@gensx/storage` package using npm, which is required to interact with GenSX's SQL database service. This is a prerequisite for accessing database functionalities. ```bash npm install @gensx/storage ``` -------------------------------- ### Example Usage of listNamespaces Function (TypeScript) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/component-reference/storage-components/search-reference.mdx This example demonstrates how to call the `listNamespaces` function on an initialized `searchClient` instance. It asynchronously fetches the list of namespaces and the `nextCursor`, then logs the retrieved namespaces to the console, showing a typical output format. ```tsx const { namespaces, nextCursor } = await searchClient.listNamespaces(); console.log("Available namespaces:", namespaces); // ["products", "customers", "orders"] ``` -------------------------------- ### Run CLAUDE.md Template Installation Directly - Bash Source: https://github.com/gensx-inc/gensx/blob/main/packages/gensx-claude-md/README.md Execute the template installation directly using npx without adding the package as a project dependency. This is a quick way to get the template file. ```bash npx @gensx/claude-md ``` -------------------------------- ### Starting Local GenSX API Server (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/examples/all-models-metadata/README.md This command starts a local HTTP API server, enabling the GenSX workflow to be tested and invoked via standard HTTP requests, simulating a production API environment. ```bash npm start ``` -------------------------------- ### Run Core Tests (pnpm) Source: https://github.com/gensx-inc/gensx/blob/main/CONTRIBUTING.md Executes the test suite for the core packages. ```bash pnpm test ``` -------------------------------- ### Initializing and Using a Logger Instance in Python Source: https://github.com/gensx-inc/gensx/blob/main/website/home/_posts/_logging.md Demonstrates the basic steps to initialize a logger instance from a library and then use it to log messages at different severity levels (info, debug, error), including passing additional contextual data as keyword arguments. ```python from logger import Logger # Initialize the logger logger = Logger() # Start logging at different levels logger.info("Application started") logger.debug("Configuration loaded", config=config) logger.error("Failed to connect to database", retry_count=3) ``` -------------------------------- ### Initializing DatabaseClient Instances (TSX) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/component-reference/storage-components/database-reference.mdx Provides examples of instantiating the `DatabaseClient` with default settings, explicitly using filesystem storage with a custom root directory, and explicitly using cloud storage. ```tsx // Default client (uses filesystem locally, cloud in production) const dbClient = new DatabaseClient(); // Explicitly use filesystem storage const localClient = new DatabaseClient({ kind: "filesystem", rootDir: "./my-data" }); // Explicitly use cloud storage const cloudClient = new DatabaseClient({ kind: "cloud" }); ``` -------------------------------- ### Example of Database.executeMultiple Method (TypeScript) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/component-reference/storage-components/database-reference.mdx This example demonstrates using `db.executeMultiple` to run a script containing several SQL DDL statements, such as creating a table and an index. It highlights its use for schema management or initial setup, where multiple statements are executed sequentially. ```tsx const results = await db.executeMultiple(` CREATE TABLE IF NOT EXISTS users ( id TEXT PRIMARY KEY, name TEXT NOT NULL, created_at TEXT DEFAULT CURRENT_TIMESTAMP ); CREATE INDEX IF NOT EXISTS idx_users_name ON users(name); `); ``` -------------------------------- ### Starting GenSX server on a custom port (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/cli-reference/start.mdx This example shows how to override the default server port (1337) by specifying a custom port, such as `3000`, using the `--port` option. This is essential when the default port is already in use or when specific network configurations are required. ```bash # Start server on port 3000 gensx start src/workflows.ts --port 3000 ``` -------------------------------- ### Setting OpenAI API Key and Running GenSX Dev Server Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/quickstart.mdx These bash commands set the `OPENAI_API_KEY` environment variable, which is required for the workflow to interact with OpenAI, and then run the GenSX development server using `pnpm dev`. The dev server exposes workflows as local REST APIs. ```bash export OPENAI_API_KEY= pnpm dev ``` -------------------------------- ### Deploying and Running GenSX Workflows (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/quickstart.mdx These bash commands are used to deploy and execute the GenSX workflows. `gensx deploy` deploys the `workflows.ts` file, requiring an `OPENAI_API_KEY` environment variable. `gensx run InitializeSearch` executes the workflow to populate the vector search namespace. `gensx run ChatWorkflow` runs the chat workflow with a sample user message and thread ID, demonstrating the RAG functionality. ```Bash gensx deploy src/workflows.ts -e OPENAI_API_KEY # initialize the search namespace gensx run InitializeSearch # run the workflow gensx run ChatWorkflow --input '{"userMessage":"Succinctly describe GenSX", "threadId":"789"}' ``` -------------------------------- ### Starting Local API Server for Workflows (PNPM) Source: https://github.com/gensx-inc/gensx/blob/main/examples/vercel-ai/README.md This command starts a local API server, making the GenSX workflows accessible via HTTP requests. This is useful for integrating the workflows with other applications or for testing via tools like curl, providing a local endpoint for interaction. ```bash pnpm start ``` -------------------------------- ### Initializing BlobClient with Different Configurations Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/component-reference/storage-components/blob-reference.mdx These examples illustrate how to instantiate `BlobClient` for default behavior (filesystem locally, cloud in production), explicitly use filesystem storage with a root directory, or explicitly use cloud storage with a default prefix. ```tsx // Default client (uses filesystem locally, cloud in production) const blobClient = new BlobClient(); // Explicitly use filesystem storage const localClient = new BlobClient({ kind: "filesystem", rootDir: "./my-data" }); // Explicitly use cloud storage with a prefix const cloudClient = new BlobClient({ kind: "cloud", defaultPrefix: "app-data/" }); ``` -------------------------------- ### Watch and Build Packages with pnpm (Shell) Source: https://github.com/gensx-inc/gensx/blob/main/CLAUDE.md Starts a development server or process that watches for file changes and automatically rebuilds packages using pnpm. ```Shell pnpm dev ``` -------------------------------- ### Deploying GenSX Workflow to Cloud with pnpm - Bash Source: https://github.com/gensx-inc/gensx/blob/main/examples/open-router/README.md This command deploys the GenSX workflow to the GenSX Cloud environment. It packages the workflow and makes it available for execution and management within the GenSX console, enabling cloud-based operation. ```bash pnpm run deploy ``` -------------------------------- ### Example of Getting and Using a Namespace in TypeScript Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/component-reference/storage-components/search-reference.mdx Illustrates how to obtain a `Namespace` instance using `searchClient.getNamespace` and then use it to perform write operations, such as upserting rows with vectors and metadata. ```tsx const namespace = await searchClient.getNamespace("products"); // Then use the namespace to upsert or query vectors await namespace.write({ upsertRows: [ { id: "product-1", vector: [0.1, 0.2, 0.3, ...], name: "Product 1", category: "electronics" } ], distanceMetric: "cosine_distance" }); ``` -------------------------------- ### Deploying GenSX Workflow to Cloud (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/examples/text-to-sql/README.md Deploys the GenSX workflow code to the GenSX Cloud environment. This makes the workflows available for execution in the cloud. ```bash pnpm run deploy ``` -------------------------------- ### Running GenSX Workflow Locally (Development) Source: https://github.com/gensx-inc/gensx/blob/main/examples/reflection/README.md This command starts the GenSX workflow locally in development mode, typically cleaning a sample text and allowing for quick testing and iteration during development. ```bash pnpm dev ``` -------------------------------- ### Using getBlob to Retrieve and Update Data Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/component-reference/storage-components/blob-reference.mdx This example demonstrates how to use `getBlob` to get a typed blob instance, retrieve its JSON content, modify it, and then save the updated JSON back to storage. ```tsx const userBlob = blobClient.getBlob("users/123.json"); const profile = await userBlob.getJSON(); // Update the profile profile.lastLogin = new Date().toISOString(); await userBlob.putJSON(profile); ``` -------------------------------- ### Running Basic Chat Completion in GenSX Cloud Source: https://github.com/gensx-inc/gensx/blob/main/examples/openai-examples/README.md This command executes the 'BasicCompletion' workflow in GenSX Cloud, providing a prompt for a simple chat completion without any tools. ```bash gensx run BasicCompletion --input '{"prompt": "Write a poem about a cat"}' ``` -------------------------------- ### Configuring useSearch Hook (TypeScript/TSX) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/component-reference/storage-components/search-reference.mdx This example illustrates how to use the `useSearch` hook with additional configuration options. It specifies a `project` and `environment` for the namespace, allowing for targeted access within a multi-project or multi-environment setup. ```tsx // With configuration const namespace = await useSearch("documents", { project: "my-project", environment: "production", }); ``` -------------------------------- ### Deploying GenSX Workflow to Cloud Source: https://github.com/gensx-inc/gensx/blob/main/examples/hacker-news-analyzer/README.md This command deploys the GenSX workflow to the GenSX Cloud environment. Successful deployment makes the workflow accessible and runnable within the GenSX console. ```bash pnpm run deploy ``` -------------------------------- ### Deploying GenSX Workflows to Cloud (Shell) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/cloud/index.mdx This command deploys the GenSX workflows from `src/workflows.ts` to the GenSX Cloud. This is the final step in the quickstart guide, making your AI agents and workflows accessible in the cloud environment. ```Shell gensx deploy src/workflows.ts ``` -------------------------------- ### Example of Managed Section in .clinerules File Source: https://github.com/gensx-inc/gensx/blob/main/packages/gensx-cline-rules/README.md Illustrates the structure of a managed section within the .clinerules file. Content between these HTML comments is automatically updated by the package during installation or updates, preserving content outside these markers. ```text ... managed content that will be updated ... ``` -------------------------------- ### Running GenSX Workflow Locally for Development - Bash Source: https://github.com/gensx-inc/gensx/blob/main/examples/open-router/README.md This command runs the GenSX workflow directly in a local development environment. It's used for testing the workflow's functionality without deploying it to the cloud or starting a local API server. ```bash pnpm run dev ``` -------------------------------- ### Logging into GenSX Source: https://github.com/gensx-inc/gensx/blob/main/examples/openai-examples/README.md This command logs the user into the GenSX platform, which is a prerequisite for deploying and managing workflows. It typically opens a browser for authentication. ```bash npx gensx login ``` -------------------------------- ### Deploying and Running GenSX Workflows (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/cli-reference/index.mdx This workflow illustrates the steps for deploying and executing GenSX workflows. It includes building and deploying a workflow file to GenSX Cloud and then running a deployed workflow with a specified input payload. ```bash # Build and deploy your workflow gensx deploy src/workflows.ts # Run a workflow gensx run my-workflow --input '{"message": "Hello, world!"}' ``` -------------------------------- ### Running DeepResearch Workflow in GenSX Cloud (CLI) Source: https://github.com/gensx-inc/gensx/blob/main/examples/deep-research/README.md This command initiates a research job by calling the deployed DeepResearch workflow in GenSX Cloud via the GenSX CLI. It passes a JSON input containing a prompt to guide the AI-powered research process. ```bash gensx run DeepResearch --input '{"prompt": "find research comparing the writing style of humans and LLMs. We want to figure out how to quantify the differences."}' ``` -------------------------------- ### Initializing Database via Local API (Curl) Source: https://github.com/gensx-inc/gensx/blob/main/examples/text-to-sql/README.md Sends a POST request to the local GenSX API server to execute the `InitializeDatabase` workflow. This sets up the database for local API testing. ```curl curl -X POST http://localhost:1337/workflows/InitializeDatabase \ -H "Content-Type: application/json" \ -d '{}' ``` -------------------------------- ### Logging In to GenSX - Bash Source: https://github.com/gensx-inc/gensx/blob/main/examples/groq-deepseek/README.md This command initiates the login process for GenSX, allowing users to authenticate their account. It is a prerequisite for deploying or interacting with GenSX workflows. ```bash npx gensx login ``` -------------------------------- ### Running InitializeSearch Workflow in Cloud Source: https://github.com/gensx-inc/gensx/blob/main/examples/rag/README.md Executes the InitializeSearch workflow in the GenSX Cloud environment to create and populate the vector search namespace. ```bash gensx run InitializeSearch ``` -------------------------------- ### Performing Common Database Operations with useDatabase Source: https://github.com/gensx-inc/gensx/blob/main/packages/gensx-storage/README.md This example lists common SQL database operations available through the `useDatabase` hook. It includes methods for executing DDL (CREATE TABLE) and DML (INSERT, SELECT) statements, batching operations, running multiple statements, migrations, getting info, and closing the database connection. ```tsx const db = await useDatabase("my-database"); // Common operations await db.execute("CREATE TABLE IF NOT EXISTS ..."); // Create table await db.execute("INSERT INTO ..."); // Insert data const result = await db.execute("SELECT * FROM ..."); // Query data await db.batch([...]); // Batch operations await db.executeMultiple("...;"); // Run multiple statements await db.migrate("...;"); // Run migrations await db.getInfo(); // Get database info await db.close(); // Close connection ``` -------------------------------- ### Wrapping Existing OpenAI Instance with GenSX (TypeScript) Source: https://github.com/gensx-inc/gensx/blob/main/packages/gensx-openai/README.md This example illustrates how to integrate GenSX functionality with an already existing OpenAI client instance using the `wrapOpenAI` function. It allows projects with pre-configured OpenAI setups to easily adopt GenSX features without changing their client initialization logic, demonstrating a chat completion call. ```ts import { OpenAI } from "openai"; import { wrapOpenAI } from "@gensx/openai"; // Create your OpenAI instance as usual const client = wrapOpenAI( new OpenAI({ apiKey: "your-api-key" }) ); // Now all methods are wrapped with GenSX functionality const completion = await client.chat.completions.create({ model: "gpt-4", messages: [{ role: "user", content: "Hello!" }] }); ``` -------------------------------- ### Run Installed Cline Rules CLI (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/packages/gensx-cline-rules/README.md Execute the command-line interface provided by the @gensx/cline-rules package after it has been installed as a project dependency. This command typically installs or updates the .clinerules file. ```bash npx gensx-cline-rules ``` -------------------------------- ### Building and Testing create-gensx (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/packages/create-gensx/README.md Commands for developers working on the create-gensx package itself, including building the project and running tests using pnpm. ```bash # Build the package pnpm run build # Run tests pnpm test ``` -------------------------------- ### Installing GenSX CLI Globally (Shell) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/cloud/index.mdx This command installs the GenSX command-line interface (CLI) globally on your system using npm. A global installation allows you to run `gensx` commands from any directory. It's the first step to begin developing with GenSX. ```Shell npm install -g gensx ``` -------------------------------- ### Running GenSX Cloud Workflows via CLI (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/examples/vercel-ai/README.md These commands demonstrate how to execute various GenSX workflows directly from the command line after they have been deployed to the GenSX Cloud. Each command specifies a workflow name and its required input, showcasing different chat completion capabilities. ```bash gensx run BasicChat --input '{"prompt": "Write a poem about a cat"}' ``` ```bash gensx run BasicChatWithTools --input '{"prompt": "What\'s the weather like in Seattle?"}' ``` ```bash gensx run StreamingChat --input '{"prompt": "Tell me a story"}' ``` ```bash gensx run StreamingChatWithTools --input '{"prompt": "What\'s the weather like in Portland?"}' ``` ```bash gensx run StructuredOutput --input '{"prompt": "Review the trash bins in my neighborhood"}' ``` ```bash gensx run StreamingStructuredOutput --input '{"prompt": "Review the trash bins in my neighborhood"}' ``` -------------------------------- ### Starting GenSX server in quiet mode (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/cli-reference/start.mdx This snippet illustrates how to start the GenSX development server with reduced console output by utilizing the `--quiet` flag. This option is useful for minimizing verbosity during automated scripts or when only critical errors need to be displayed. ```bash # Start server with minimal output gensx start src/workflows.ts --quiet ``` -------------------------------- ### Running Chat Completion with Tools in GenSX Cloud Source: https://github.com/gensx-inc/gensx/blob/main/examples/openai-examples/README.md This command executes the 'Tools' workflow in GenSX Cloud, demonstrating chat completion with integrated tool usage, specifically for weather information. ```bash gensx run Tools --input '{"prompt": "What\'s the weather like in Seattle?"}' ``` -------------------------------- ### Installing Cursor Rules as a Development Dependency (npm/pnpm) Source: https://github.com/gensx-inc/gensx/blob/main/packages/gensx-cursor-rules/README.md These commands install the `@gensx/cursor-rules` package as a development dependency using either `npm` or `pnpm`. Installing it as a dev dependency ensures it's available for project-specific scripts and version control, making it suitable for continuous integration and team development. ```bash npm install --save-dev @gensx/cursor-rules ``` ```bash pnpm add -D @gensx/cursor-rules ``` -------------------------------- ### Testing Workflows Locally via PNPM Dev (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/examples/vercel-ai/README.md These commands allow direct local testing of the different GenSX workflows using the `pnpm dev` script. Each command targets a specific workflow type and provides a sample input prompt, facilitating rapid iteration and debugging without cloud deployment. ```bash pnpm dev "basic" "Write a poem about a cat" ``` ```bash pnpm dev "basic-tools" "What's the weather like in Seattle?" ``` ```bash pnpm dev "stream" "Tell me a short story" ``` ```bash pnpm dev "stream-tools" "What's the weather like in Portland?" ``` ```bash pnpm dev "structured" "Review the trash bins in my neighborhood" ``` ```bash pnpm dev "structured-stream" "Review the trash bins in my neighborhood" ``` -------------------------------- ### Running BasicCompletion Workflow in GenSX Cloud (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/examples/anthropic-examples/README.md This command executes the `BasicCompletion` workflow in the GenSX Cloud, providing an input prompt for a basic chat completion without tools. ```bash gensx run BasicCompletion --input '{"prompt": "Write a poem about a cat"}' ``` -------------------------------- ### Installing @gensx/anthropic Package Source: https://github.com/gensx-inc/gensx/blob/main/packages/gensx-anthropic/README.md This snippet demonstrates how to install the `@gensx/anthropic` package using npm, which is required to use the pre-wrapped Anthropic SDK with GenSX. ```bash npm install @gensx/anthropic ``` -------------------------------- ### Creating GenSX Project with Options (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/packages/create-gensx/README.md Use command-line options when creating a GenSX project, such as specifying a template (default is 'ts') or forcing creation in a non-empty directory. ```bash # Use a specific template (default: ts) npm create gensx@latest my-app --template ts # Force creation in non-empty directory npm create gensx@latest my-app --force ``` -------------------------------- ### Comparing Traditional and Contextual Logging in Python Source: https://github.com/gensx-inc/gensx/blob/main/website/home/_posts/_logging.md Demonstrates the difference between manual logging, where details must be explicitly included in the message, and modern contextual logging, where the logger automatically captures relevant information like query details, parameters, and stack traces. ```python # Traditional logging approach logger.error(f"Database query failed: {error}") # With automatic contextual logging logger.error("Query failed") # Automatically includes query details, parameters, and stack trace ``` -------------------------------- ### Install Windsurf Rules as Dev Dependency (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/packages/gensx-windsurf-rules/README.md These commands demonstrate how to install the @gensx/windsurf-rules package as a development dependency using npm, yarn, or pnpm. ```bash npm install --save-dev @gensx/windsurf-rules # or yarn add -D @gensx/windsurf-rules # or pnpm add -D @gensx/windsurf-rules ``` -------------------------------- ### Logging into GenSX CLI - Bash Source: https://github.com/gensx-inc/gensx/blob/main/examples/open-router/README.md This command logs the user into the GenSX command-line interface, which is a prerequisite for deploying and managing GenSX workflows. It establishes the necessary authentication for interacting with the GenSX platform. ```bash npx gensx login ``` -------------------------------- ### Example of Retrieving Namespace Schema in TypeScript Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/component-reference/storage-components/search-reference.mdx Demonstrates how to call `getSchema` on a namespace instance to retrieve and log its current schema definition, showing an example output structure. ```tsx const schema = await namespace.getSchema(); console.log(schema); // { // text: "string", // category: "string", // createdAt: "string" // } ``` -------------------------------- ### Installing GenSX Storage Package (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/cloud/storage/blob-storage.mdx This snippet demonstrates how to install the `@gensx/storage` package using npm, which is required to access blob storage functionalities in a GenSX application. ```bash npm install @gensx/storage ``` -------------------------------- ### Installing Anthropic GenSX SDK with npm Source: https://github.com/gensx-inc/gensx/blob/main/website/docs/src/content/component-reference/anthropic.mdx This command installs the `@gensx/anthropic` package along with the official `@anthropic-ai/sdk` as a peer dependency, enabling the use of Anthropic's API with GenSX functionality. ```bash npm install @gensx/anthropic @anthropic-ai/sdk ``` -------------------------------- ### Installing @gensx/core peer dependency with npm Source: https://github.com/gensx-inc/gensx/blob/main/packages/gensx-vercel-ai/README.md This command installs `@gensx/core`, which is a required peer dependency for `@gensx/vercel-ai`. It ensures that the core GenSX functionalities are available for the AI SDK to operate correctly. ```bash npm install @gensx/core ``` -------------------------------- ### Installing @gensx/vercel-ai with npm Source: https://github.com/gensx-inc/gensx/blob/main/packages/gensx-vercel-ai/README.md This command installs the `@gensx/vercel-ai` package using npm, making it available for use in your project. It's the primary step to integrate the Vercel AI SDK with GenSX. ```bash npm install @gensx/vercel-ai ``` -------------------------------- ### Running GenSX Workflow Locally with Dev Server (Bash) Source: https://github.com/gensx-inc/gensx/blob/main/examples/text-to-sql/README.md Runs the GenSX workflow locally using the development server. This command automatically initializes the database if needed and executes the `TextToSqlWorkflow` with the provided question. ```bash pnpm dev "Who has the highest batting average?" ```