### Running Asset Serving Examples Source: https://docs.jaseci.org/jac-client/asset-serving/intro Instructions on how to run the provided asset serving examples. This involves navigating to the example directory, installing dependencies, and starting the Jac server. ```bash cd jac-client/jac_client/examples/asset-serving/ npm install jac start main.jac ``` -------------------------------- ### Running Jac Examples Source: https://docs.jaseci.org/jac-client/styling/intro Provides the command-line instructions to navigate to an example directory, install dependencies using npm, and run a Jac application. This is a general guide for executing the provided styling examples. ```shell # Navigate to example directory cd jac_client/examples/css-styling/ # Install dependencies npm install # Run the application jac start main.jac ``` -------------------------------- ### Jaseci API Example: Running and Testing Source: https://docs.jaseci.org/tutorials/production/local Demonstrates how to run the Jaseci API example using the `jac start` command and how to test its endpoints using `curl`. This includes starting the server with specific options and making POST and GET requests to create and list users, as well as checking the health status. ```shell jac start api.jac --port 8000 --dev # Create user curl -X POST http://localhost:8000/create_user \ -H "Content-Type: application/json" \ -d '{"name": "Alice", "email": "alice@example.com"}' # List users curl http://localhost:8000/list_users # Health check curl http://localhost:8000/health ``` -------------------------------- ### Install Jac Client Source: https://docs.jaseci.org/jac-client/guide-example/step-01-setup Installs the `jac-client` package using pip. This is a prerequisite for using Jac commands like `jac create` and `jac start`. ```bash pip install jac-client ``` -------------------------------- ### Write and Run First Jac Program Source: https://docs.jaseci.org/quick-guide/hello-world This snippet shows how to create a simple 'Hello, World!' program in Jac and execute it using the 'jac' command. It requires the Jac compiler to be installed. ```Jac with entry { print("Hello, World!"); } ``` ```Shell jac hello.jac ``` -------------------------------- ### Setup and Develop Jac Desktop Application Source: https://docs.jaseci.org/jac-client/multi-targets/intro Details the process of adding desktop support to a Jac project, including the one-time setup command, starting development with hot-reloading, and building the final desktop installer. ```bash # Setup desktop target (one-time) jac setup desktop # Develop with hot reload jac start main.jac --client desktop --dev # Build installer jac build main.jac --client desktop ``` -------------------------------- ### Run a Community Jacpack from GitHub Source: https://docs.jaseci.org/quick-guide/hello-world This demonstrates how to create a new project from a Jacpack template hosted on GitHub. It involves specifying a project name, the URL of the Jacpack, navigating into the created directory, adding dependencies, and starting the application. ```Shell jac create my-todo --use https://raw.githubusercontent.com/jaseci-labs/jacpacks/main/multi-user-todo-app/multi-user-todo-app.jacpack cd my-todo jac add jac start main.jac ``` -------------------------------- ### Run Jac Examples as API Server Source: https://docs.jaseci.org/tutorials/examples This code shows how to launch a Jac example as a local API server. After starting the server, you can access its documentation via a web browser. This is useful for integrating Jac applications into other services. ```bash # Start the example as an API jac start example_name/main.jac # View API documentation open http://localhost:8000/docs ``` -------------------------------- ### Install Individual Jaseci Plugins Source: https://docs.jaseci.org/learn/installation Installs specific Jaseci ecosystem packages individually based on your needs. This allows for a modular installation, choosing only the components you require. ```bash # AI/LLM integration pip install byllm # Full-stack web development pip install jac-client # Production deployment & scaling pip install jac-scale # Enhanced console output pip install jac-super ``` -------------------------------- ### Running Jaseci Nested Folder Examples Source: https://docs.jaseci.org/jac-client/file-system/nested-imports Provides instructions on how to set up and run Jaseci examples that utilize nested folder structures. It includes commands for navigating to example directories, installing dependencies, and starting the Jaseci application. ```bash cd jac-client/jac_client/examples/nested-folders/ npm install jac start main.jac ``` -------------------------------- ### Quick Install Jaseci Source: https://docs.jaseci.org/learn/installation Installs the 'jaseci' meta-package, which includes the Jac language compiler, AI/LLM integration, web development client, deployment tools, and enhanced console output. This is the recommended method for a full Jaseci experience. ```bash pip install jaseci ``` -------------------------------- ### Jac Project Structure Example Source: https://docs.jaseci.org/tutorials/fullstack/setup Illustrates the typical file and directory structure generated for a Jac project, including configuration, entry points, components, and assets. ```tree myapp/ ├── jac.toml # Configuration ├── main.jac # Entry point (frontend + backend) ├── README.md # Project readme ├── components/ # Reusable UI components │ └── Button.cl.jac # Example button component ├── assets/ # Static assets (images, fonts) ├── .jac/ # Build artifacts (gitignored) └── .gitignore # Git ignore rules ``` -------------------------------- ### Jac Backend Import Example Source: https://docs.jaseci.org/tutorials/fullstack/setup Shows how to import backend definitions (nodes, walkers) from one Jac file into another. ```jac # api.jac import from models { User, Todo } walker get_user { can visit with `root entry { report {}; } } ``` -------------------------------- ### Jac Configuration Options (`jac.toml`) Source: https://docs.jaseci.org/tutorials/fullstack/setup Detailed example of the `jac.toml` file, showcasing various configuration sections including project metadata, client-specific settings, and dependencies. ```toml [project] name = "myapp" version = "0.1.0" entry-point = "main.jac" [plugins.client] # Client-specific config [plugins.client.configs.postcss] plugins = ["tailwindcss", "autoprefixer"] [dependencies] # Python packages [dependencies.npm] # npm packages [dev-dependencies] watchdog = ">=3.0.0" ``` -------------------------------- ### Running Jac Nested Folder Example Project Source: https://docs.jaseci.org/jac-client/file-system/intro Provides the command-line instructions to run a Jac example project that utilizes nested folder structures. This involves navigating to the example directory, installing dependencies with npm, and starting the Jac application. ```bash cd jac-client/jac_client/examples/nested-folders/ npm install jac start main.jac ``` -------------------------------- ### Jac CLI: Start Application with Scale Source: https://docs.jaseci.org/community/release_notes/jac-scale Demonstrates how to start a Jac application with the Jac-Scale framework. It shows the default PyPI installation method and an experimental mode that clones the repository. ```bash jac start app.jac --scale ``` ```bash jac start app.jac --scale --experimental ``` -------------------------------- ### Jac Frontend Import Example Source: https://docs.jaseci.org/tutorials/fullstack/setup Demonstrates importing a frontend component from a separate file into the main application file using the `cl { }` block. ```jac # main.jac cl { import from "./components/Header.cl.jac" { Header } def:pub app() -> any { return
Content
; } } ``` -------------------------------- ### Install Jac Client Package Source: https://docs.jaseci.org/jac-client Installs the Jac client library using pip. This command assumes Python and pip are already installed. ```bash pip install jac-client ``` -------------------------------- ### Activate Virtual Environment and Install Jaseci Source: https://docs.jaseci.org/learn/installation Sets up and activates a Python virtual environment for Jaseci installation, ensuring project dependencies are isolated. This is the recommended approach for managing Jaseci installations. ```bash # Create environment python -m venv jac-env # Activate it source jac-env/bin/activate # Linux/Mac jac-env\Scripts\activate # Windows # Install Jac pip install jaseci ``` -------------------------------- ### Install and Configure Pre-commit Hooks Source: https://docs.jaseci.org/community/internals/contrib This snippet demonstrates how to set up a Python virtual environment, install necessary development tools like pre-commit, pytest, and pytest-xdist, and then install the pre-commit hooks. These hooks automate code formatting, linting, and type checking. ```bash python3 -m venv ~/.jacenv/ source ~/.jacenv/bin/activate pip3 install pre-commit pytest pytest-xdist pre-commit install ``` -------------------------------- ### Jac Main File: Backend and Frontend Code Source: https://docs.jaseci.org/tutorials/fullstack/setup Example of a `main.jac` file demonstrating both backend (nodes, walkers) and frontend (client-side code within `cl` block) definitions. ```jac # Backend code (nodes, walkers) node Todo { has title: str; has done: bool = False; } walker:pub get_todos { can fetch with `root entry { for todo in [-->](`?Todo) { report todo; } } } # Frontend code (inside cl block) cl { def:pub app() -> any { has message: str = "Hello from Jac!"; return

{message}

; } } ``` -------------------------------- ### Install Bun using curl Source: https://docs.jaseci.org/jac-client Installs the Bun JavaScript runtime environment using a curl command. This is a prerequisite for using the Jac client. ```bash curl -fsSL https://bun.sh/install | bash ``` -------------------------------- ### Install byLLM Package Source: https://docs.jaseci.org/tutorials/ai/quickstart Installs the byLLM Python package using pip. This is a prerequisite for using byLLM in your Jac projects. ```bash pip install byllm ``` -------------------------------- ### Serve Documentation Locally Source: https://docs.jaseci.org/community/contributing Installs the documentation package and serves the Jaseci documentation site locally. This is useful for previewing documentation changes before committing. ```bash pip install -e docs python docs/scripts/mkdocs_serve.py ``` -------------------------------- ### Start Jac Development Server Source: https://docs.jaseci.org/jac-client Starts the Jac development server for the 'main.jac' application. This command launches both a backend server for graph operations and a frontend development server. ```bash cd todo-app jac start main.jac ``` -------------------------------- ### Jaseci Development Server and API Key Setup Source: https://docs.jaseci.org/tutorials/fullstack/todo-app Instructions for running the Jaseci development server and setting the necessary API key for AI features. This involves exporting the `ANTHROPIC_API_KEY` environment variable and then starting the server using the `jac start` command. ```bash # Set your API key for AI features export ANTHROPIC_API_KEY="your-key-here" # Start the server jac start main.jac --port 8000 ``` -------------------------------- ### Setup Desktop Environment with Tauri Source: https://docs.jaseci.org/jac-client/multi-targets/desktop-target Installs necessary components for desktop application development using Tauri. This command prepares your environment for building desktop targets. ```bash jac setup desktop ``` -------------------------------- ### Run Jac App in Production Mode Source: https://docs.jaseci.org/tutorials/fullstack/setup Command to start the Jac application in production mode, optimized for deployment. ```bash jac start ``` -------------------------------- ### Set Up Development Environment Source: https://docs.jaseci.org/community/contributing Commands to create and activate a Python virtual environment, and install the Jaseci project dependencies including Jac and related tools. It also installs pre-commit for code linting and Pytest for testing. ```bash python3 -m venv .venv source .venv/bin/activate pip install -e jac pip install -e jac-byllm pip install -e jac-scale pip install -e jac-client pip install pre-commit pre-commit install pip install pytest pytest-xdist pytest-asyncio ``` -------------------------------- ### Run a Jacpack with AI Integration Source: https://docs.jaseci.org/quick-guide/hello-world This snippet shows how to set up and run a Jacpack that includes AI features, specifically the 'multi-user-todo-meals-app'. It requires setting an environment variable for the Anthropic API key before creating and starting the application. ```Shell export ANTHROPIC_API_KEY="your-key-here" jac create meals-app --use https://raw.githubusercontent.com/jaseci-labs/jacpacks/main/multi-user-todo-meals-app/multi-user-todo-meals-app.jacpack cd meals-app jac add jac start main.jac ``` -------------------------------- ### Scaffold a Full-Stack Jac Application Source: https://docs.jaseci.org/quick-guide/hello-world This command sequence uses the 'jac-client' plugin to create a new full-stack application with a Jac backend and React frontend. It then navigates into the project directory, adds dependencies, and starts the application. ```Shell jac create example --use fullstack cd example jac add jac start main.jac ``` -------------------------------- ### Build and Run Basic Web App with Jaseci Source: https://docs.jaseci.org/jac-client/multi-targets/web-target Commands to build and start the basic web application example using the Jaseci CLI. This process compiles the Jaseci code and launches a development server. ```bash jac build main.jac jac start main.jac ``` -------------------------------- ### Jac Language Server Setup Source: https://docs.jaseci.org/reference/language/foundation Command to start the Jac language server, which provides language support for editors like VS Code. ```Shell # Start the language server jac lsp ``` -------------------------------- ### Text Summarization Example in Jac Source: https://docs.jaseci.org/tutorials/ai/quickstart A Jac program demonstrating text summarization using byLLM. It defines a function to summarize an article and then prints the generated summary. ```jac import from byllm.lib { Model } glob llm = Model(model_name="gpt-4o-mini"); """Summarize this article in 2-3 bullet points.""" def summarize(article: str) -> str by llm(); with entry { article = """ Artificial intelligence has made remarkable progress in recent years. Large language models can now write code, answer questions, and even create art. However, challenges remain around safety, bias, and environmental impact. Researchers are actively working on solutions. """ summary = summarize(article); print(summary); } ``` -------------------------------- ### Jac Single File Project Structure Source: https://docs.jaseci.org/tutorials/fullstack/setup Example of organizing a small Jac application within a single `main.jac` file, including both backend and frontend code. ```jac # main.jac - everything in one file # Backend node User { has name: str = ""; } walker get_user { can visit with `root entry { report {}; } } # Frontend cl { def:pub app() -> any { return
App
; } } ``` -------------------------------- ### Starting a Jaseci App with `jac start` Source: https://docs.jaseci.org/jac-client/file-system/main Shows the two primary methods for starting a Jaseci client application. Option 1 explicitly specifies `main.jac`, while Option 2 (recommended) uses the `entry-point` defined in `jac.toml` for a more streamlined workflow. ```bash # Option 1: Specify the file path jac start main.jac # Option 2: Use jac.toml entry-point (recommended) jac start ``` -------------------------------- ### Test AI Function with MockLLM in Jaseci Source: https://docs.jaseci.org/tutorials/ai/quickstart Demonstrates how to use MockLLM for deterministic testing of AI functions in Jaseci. It shows the setup of MockLLM with predefined outputs and the definition and testing of a simple translate function. ```jaseci import from byllm.lib { MockLLM } glob llm = MockLLM( model_name="mockllm", config={ "outputs": ["Mocked response 1", "Mocked response 2"] } ); """Translate text.""" def translate(text: str) -> str by llm(); test test_translate { result = translate("Hello"); assert result == "Mocked response 1"; } ``` -------------------------------- ### Jaseci Project Initialization and Development Workflow Source: https://docs.jaseci.org/jac-client/advance/configuration-overview Illustrates the typical workflow for starting a new Jaseci client project, adding packages, customizing the build, and serving the application. This sequence of commands guides the user through project setup. ```bash # 1. Create project jac create --use client my-app cd my-app # 3. Add custom packages jac add --npm lodash jac add --npm --dev sass # 5. Build/serve jac start main.jac ``` -------------------------------- ### Verify Rust Installation Source: https://docs.jaseci.org/jac-client/multi-targets/desktop-target Checks if Rust and Cargo have been installed correctly by displaying their version numbers. This command is used after installing Rust to confirm the setup. ```bash rustc --version ``` ```bash cargo --version ``` -------------------------------- ### Minimal Install Jac Language Source: https://docs.jaseci.org/learn/installation Installs only the core 'jaclang' package, providing the Jac language and its compiler. This is suitable if you only need the language features without additional ecosystem tools. ```bash pip install jaclang ``` -------------------------------- ### Generic Jacpack Creation Command Source: https://docs.jaseci.org/quick-guide/hello-world This is a general command template for creating a new project from any Jacpack available on GitHub. Users need to replace the placeholder values with the desired project name and the specific Jacpack URL. ```Shell jac create my-app --use https://raw.githubusercontent.com/jaseci-labs/jacpacks/main//.jacpack ``` -------------------------------- ### Verify Jaseci Installation Source: https://docs.jaseci.org/learn/installation Checks if Jaseci is installed correctly by running the 'jac --version' command. This command displays the installed Jaseci version, Python version, and platform information, along with links to documentation and community resources. ```bash jac --version ``` -------------------------------- ### Verify Bun Installation Source: https://docs.jaseci.org/jac-client Checks if the Bun JavaScript runtime is installed correctly by displaying its version number. ```bash bun --version ``` -------------------------------- ### Jaseci Project Structure Example Source: https://docs.jaseci.org/jac-client/file-system/main Provides a typical directory structure for a Jaseci client project. It shows the placement of the essential `main.jac` file at the root, alongside configuration files, components, and assets. ```text my-app/ ├── jac.toml # Project configuration (entry-point = "main.jac") ├── main.jac # Required entry point ├── components/ # Reusable components │ └── Button.tsx # Example TypeScript component ├── assets/ # Static assets (images, fonts, etc.) └── build/ # Build output (generated) ``` -------------------------------- ### Manually Install Packages in Jac Project Source: https://docs.jaseci.org/jac-client Installs packages manually within the '.jac/client/' directory of a Jac project. This is an alternative to `jac add --npm` or automatic installation. ```bash bun install ``` -------------------------------- ### Minimal `main.jac` Example with Hello World Source: https://docs.jaseci.org/jac-client/file-system/main A basic example of a `main.jac` file demonstrating the minimal required structure. It includes a publically exported `app()` function within a `cl {}` block that returns a simple 'Hello, World!' heading using JSX. ```jac cl { def:pub app() -> any { return

Hello, World!

; } } ``` -------------------------------- ### Jaseci CLI Setup Command Source: https://docs.jaseci.org/reference/plugins/jac-client Performs one-time initialization for a build target, such as setting up prerequisites for desktop builds using Tauri. Requires a target name as an argument. ```bash jac setup # Examples: # Setup desktop target (installs Tauri prerequisites) jac setup desktop ``` -------------------------------- ### Tauri Configuration Example (tauri.conf.json) Source: https://docs.jaseci.org/jac-client/multi-targets/desktop-target Example JSON configuration for a Tauri desktop application. This file defines product details, version, identifier, and window properties like title, size, and resizability. ```json { "productName": "My App", "version": "1.0.0", "identifier": "com.example.myapp", "app": { "windows": [ { "title": "My App", "width": 1200, "height": 800, "minWidth": 800, "minHeight": 600, "resizable": true, "fullscreen": false } ] } } ``` -------------------------------- ### Template Bundling and Creation Source: https://docs.jaseci.org/community/release_notes/jaclang Details on how to bundle project templates into distributable `.jacpack` files and how to use these templates for creating new projects. ```APIDOC ## Template Bundling with `jac jacpack pack` ### Description Bundles project templates into distributable `.jacpack` files. Templates are defined in `jac.toml` and source files with placeholders. ### Method `jac jacpack pack` ### Endpoint N/A (Command-line tool) ### Parameters #### Command Arguments - **(Implicit)** Requires a `jac.toml` file with a `[jacpack]` section and template source files. ### Request Example ```bash jac jacpack pack ``` ### Response Creates a `.jacpack` file containing the bundled template. ## Project Creation with `jac create` ### Description Creates new projects from template directories or `.jacpack` files. ### Method `jac create` ### Endpoint N/A (Command-line tool) ### Parameters #### Command Arguments - **[project_name]** (string) - The name of the new project. - **--use** or **-u** (string) - Specifies the template source. Can be a local path to a `.jacpack` file, a template directory, or a URL to a remote template. - **--list-jacpacks** or **-l** (boolean) - Lists available jacpacks. ### Request Example ```bash # Create a project using a local jacpack file jac create myapp --use ./my_template.jacpack # Create a project using a template directory jac create anotherapp --use ./template_dir # Create a project using a remote template URL jac create webapp --use https://example.com/templates/webapp.jacpack # List available jacpacks jac create --list-jacpacks ``` ### Response Creates a new project directory with the specified name, populated from the chosen template. ``` -------------------------------- ### JacTestClient - Full Example Source: https://docs.jaseci.org/reference/testing A comprehensive example demonstrating the usage of JacTestClient for testing a CRUD (Create, Read, Update, Delete) operation, including setup, request, and cleanup. ```APIDOC ## JacTestClient - Full Example ### Description This example illustrates a complete test case using `JacTestClient` to perform Create, Read, Update, and Delete operations on tasks. It includes client initialization, user authentication, making requests, and asserting responses. ### Request Example ```python import pytest from jaclang.runtimelib.testing import JacTestClient def test_task_crud(tmp_path): # Initialize client from file with a temporary path client = JacTestClient.from_file("app.jac", base_path=str(tmp_path)) # Register and authenticate a user client.register_user("testuser", "password123") # Create a task via POST request resp = client.post("/walker/CreateTask", json={"title": "My Task"}) assert resp.status_code == 200 assert resp.ok # Read tasks via POST request resp = client.post("/walker/GetTasks") data = resp.json() assert len(data["reports"]) == 1 # Cleanup: Close the client client.close() ``` ``` -------------------------------- ### Create Jac App Skipping Package Installation Source: https://docs.jaseci.org/jac-client Scaffolds a new client-side Jac application named 'todo-app' but skips the automatic installation of default packages. This allows for manual control over package installation. ```bash jac create --use client --skip todo-app ``` -------------------------------- ### Create Jac Project and Navigate Source: https://docs.jaseci.org/tutorials/fullstack/setup Command to create a new Jac project with a client component and change the directory into the newly created project folder. ```bash jac create --use client myapp cd myapp ``` -------------------------------- ### Install Jaseci Extension in VS Code Source: https://docs.jaseci.org/learn/installation Installs the official Jac language extension for Visual Studio Code via the command palette. This extension provides features like syntax highlighting, autocomplete, and error detection for Jac files. ```bash ext install jaseci-labs.jaclang-extension ``` -------------------------------- ### Configure OpenAI LLM Models Source: https://docs.jaseci.org/tutorials/ai/quickstart Demonstrates how to configure different OpenAI language models using the byLLM Model class. This allows selection of specific models like gpt-4o-mini, gpt-4o, or gpt-4. ```jac glob llm = Model(model_name="gpt-4o-mini"); glob llm = Model(model_name="gpt-4o"); glob llm = Model(model_name="gpt-4"); ``` -------------------------------- ### Install Jac and Plugins using pip Source: https://docs.jaseci.org/tutorials/troubleshooting Installs the Jac language and its associated plugins (byllm, jac-client, jac-scale) using pip. Ensure your virtual environment is activated if applicable. ```bash pip install jaseci source .venv/bin/activate # Linux/Mac .venv\Scripts\activate # Windows # Install specific plugins pip install byllm # For AI features pip install jac-client # For full-stack pip install jac-scale # For production deployment ``` -------------------------------- ### Run Jac App in Development Mode Source: https://docs.jaseci.org/tutorials/fullstack/setup Command to start the Jac development server with hot reloading enabled. This also starts a Vite dev server and an API server. ```bash jac start --dev ``` -------------------------------- ### Tool Docstring with Args, Returns, and Description Source: https://docs.jaseci.org/reference/plugins/byllm An example of a comprehensive docstring for a tool function ('search_products'). It includes a description of the tool's purpose, detailed explanations of arguments, and the structure of the return value. ```jaseci """ Search products in the catalog. Args: query: Search terms category: Optional category filter max_results: Maximum number of results (default 10) Returns: List of matching product records """ def search_products(query: str, category: str = "", max_results: int = 10) -> list[dict] { # Implementation } ``` -------------------------------- ### Jac Server-Side Development: REST API with jac start Source: https://docs.jaseci.org/reference/language/full-stack Explains how public walkers in Jac automatically become REST endpoints when the server is started with 'jac start'. It shows an example of a 'GetUsers' walker that reports user data, which can then be accessed via a POST request. ```jac walker:pub GetUsers { can get with `root entry { users = [-->(`?User)]; report users; } } # Endpoint: POST /GetUsers # Start the server: jac start main.jac --port 8000 ``` -------------------------------- ### Run Jac Program Source: https://docs.jaseci.org/tutorials/ai/quickstart Executes a Jac program file. This command is used to run the `hello_ai.jac` script created in the previous step. ```bash jac hello_ai.jac ``` -------------------------------- ### Install Jac Development Dependencies Source: https://docs.jaseci.org/jac-client/guide-example/step-01-setup Installs development dependencies for Jac, including packages required for features like Hot Module Replacement (HMR). This command should be run if HMR or other dev features are not working. ```bash jac install --dev ``` -------------------------------- ### Run Jac Examples from Source Source: https://docs.jaseci.org/tutorials/examples This snippet demonstrates how to clone the Jaseci repository and run a Jac example directly from its source code. It involves cloning the repository, navigating to the examples directory, and executing a specific example using the 'jac run' command. ```bash # Clone the repository git clone https://github.com/Jaseci-Labs/jaseci.git cd jaseci/examples # Run an example jac example_name/main.jac ``` -------------------------------- ### Install Jac Dev Dependencies Source: https://docs.jaseci.org/jac-client Installs development dependencies for the Jac project, including packages like 'watchdog' required for HMR. This command should be run if HMR is not functioning correctly. ```bash jac install --dev ``` -------------------------------- ### Code Generation Example in Jac Source: https://docs.jaseci.org/tutorials/ai/quickstart An example Jac program that generates code based on a description. It defines a function `generate_code` that takes a description and returns a string representing the generated code. ```jac import from byllm.lib { Model } glob llm = Model(model_name="gpt-4o-mini"); """Generate a Python function based on the description.""" def generate_code(description: str) -> str by llm(); with entry { desc = "A function that checks if a string is a palindrome"; code = generate_code(desc); print(code); } ``` -------------------------------- ### Create Jac Project Source: https://docs.jaseci.org/jac-client/guide-example/step-01-setup Initializes a new Jac project named 'todo-app' with a standard directory structure. This command sets up the foundational files for your Jac application. ```bash jac create --use client todo-app ``` -------------------------------- ### Sentiment Analysis Example in Jac Source: https://docs.jaseci.org/tutorials/ai/quickstart An example Jac program that performs sentiment analysis on a list of texts. It defines an enum for sentiment and uses a byLLM function to analyze the sentiment of each text. ```jac import from byllm.lib { Model } glob llm = Model(model_name="gpt-4o-mini"); enum Sentiment { POSITIVE, NEGATIVE, NEUTRAL } """Analyze the sentiment of this text.""" def analyze_sentiment(text: str) -> Sentiment by llm(); with entry { texts = [ "I love this product! It's amazing!", "This is the worst experience ever.", "The package arrived on Tuesday." ]; for text in texts { sentiment = analyze_sentiment(text); print(f"{sentiment}: {text[:40]}..."); } } ```