Skip to content

Conversation

@thejhh
Copy link
Contributor

@thejhh thejhh commented Apr 29, 2025

This PR and branch is obsolete. Current work is done in the gnd repository: https://github.com/hyperifyio/gnd/pulls


This pull request introduces the first working version of Gendo, a simple, node-based programming language designed to orchestrate LLM behavior through declarative flows. Gendo allows you to define how inputs are parsed, processed, and returned—entirely through structured prompt logic and tool integration.

✅ Included Example: examples/calculator.gendo

This example demonstrates a minimal but fully functional program that turns natural language into a math result using an OpenAI-compatible LLM backend:

# Calculator example using math tool

# Error handler
2: Explain what went wrong with the calculation in simple terms.

# If any following operation fails, it goes to node 2 for error explanation
2!

# Input formatter (from stdin)
0: Extract the mathematical operation from the text. Return only the mathematical expression, removing any natural language. For example: "What is 1 plus 1?" -> "1 + 1", "Calculate 5 times 3" -> "5 * 3", "Divide 10 by 2" -> "10 / 2"

# Result formatter (to stdout)
1: Format the calculation result in a natural language response. For example: If input is "2", respond with "The result is 2."

# Define a math tool for calculations
3: tool math

# Formatted input lines go to math tool
3 < 0

# Math result goes to the output formatter
1 < 3

🧪 How to Run

This example runs with any OpenAI-compatible LLM backend. For local testing, we use Microsoft's BitNet:

export GENDO_API_BASE=http://localhost:18080/v1
export GENDO_API_KEY=
export GENDO_MODEL=bitnet
make
echo 'What is 1+1?' | ./gendo examples/calculator.gendo

Expected output:

The result is 2.

🧠 Behind the Scenes

This Gendo program consists of:

  • A natural language input formatter (node 0)
  • A math tool (node 3) that performs the actual computation
  • A result formatter (node 1) that constructs the output
  • An error handler (node 2) that explains failures in user-friendly terms
  • Node routing: 3 < 0 and 1 < 3, with fallback to 2! for all nodes

🚀 BitNet Setup

You can run the BitNet LLM server locally like this:

./build/bin/llama-server --alias bitnet \
  -m models/BitNet-b1.58-2B-4T/ggml-model-i2_s.gguf \
  --host 0.0.0.0 --port 18080 -t 3 -np 2 --prio 3

No GPU is required. BitNet runs in approximately 2 GB of RAM.


Feedback is especially welcome on:

  • Node syntax and chaining (< and !)
  • Prompt conventions and formatting
  • Error routing behavior
  • Tool integration patterns

This release lays the foundation for building composable LLM-based applications with declarative logic.

@thejhh thejhh requested a review from Copilot April 29, 2025 19:46
@thejhh thejhh self-assigned this Apr 29, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR provides the initial implementation for the Gendo programming language with integration to a local BitNet server running an OpenAI‐compatible API.

  • Implements a logging package with different verbosity levels.
  • Integrates the OpenAI LLM interface and registers it within the runtime.
  • Establishes the core engine to parse and process Gendo scripts and nodes.

Reviewed Changes

Copilot reviewed 18 out of 29 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/log/log.go New logging functions for debug, info, and error reporting.
pkg/llm/openai/openai.go OpenAI LLM integration including API key management and request handling.
pkg/llm/llm.go Defines the LLM interface and registry.
internal/gendo/gendo_test.go Unit tests for node processing ensuring expected prompt and input handling.
internal/gendo/gendo.go Implements the script execution engine and processing chain for nodes.
examples/README.md Documentation on script examples and configuration details.
cmd/gendo/main.go Command-line entry point for running Gendo scripts.
README.md Updated language specification for Gendo.
LICENSE Updated license information.
Files not reviewed (11)
  • .cursor/rules/development-workflow.mdc: Language not supported
  • .cursor/rules/llm-integration.mdc: Language not supported
  • .cursor/rules/math-tool.mdc: Language not supported
  • .cursor/rules/project-structure.mdc: Language not supported
  • .cursor/rules/testing-requirements.mdc: Language not supported
  • Makefile: Language not supported
  • examples/calculator.gendo: Language not supported
  • examples/file_processor.gendo: Language not supported
  • examples/hello.gendo: Language not supported
  • examples/random_story.gendo: Language not supported
  • go.mod: Language not supported

@thejhh thejhh changed the title Develop Initial implementation for LLM-based gendo programming language. Apr 29, 2025
@thejhh thejhh changed the title Initial implementation for LLM-based gendo programming language. Initial implementation for LLM-based gendo programming language Apr 29, 2025
@thejhh thejhh added the enhancement New feature or request label Apr 29, 2025
@thejhh thejhh changed the title Initial implementation for LLM-based gendo programming language Initial implementation of gendo: an LLM-based programming language Apr 29, 2025
@thejhh thejhh requested a review from Copilot May 1, 2025 19:55
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request introduces the initial implementation of Gendo, an LLM-based programming language for orchestrating language model behavior through node-based pipelines. Key changes include a core LLM interface and registry (pkg/llm/llm.go), the main Gendo engine for processing nodes and script I/O (internal/gendo/gendo.go), and comprehensive tests and documentation updates that demonstrate tool integration and node chaining.

Reviewed Changes

Copilot reviewed 26 out of 38 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/llm/llm.go Defines the LLM interface and registry for language model implementations.
internal/gendo/gendo_test.go Introduces unit tests for node processing and prompt handling.
internal/gendo/gendo.go Implements core processing logic for nodes, I/O, error handling, and routing.
examples/README.md Provides example scripts and configuration guidelines for Gendo.
cmd/gendo/main.go Adds the command-line interface to run Gendo scripts.
README.md Updates the language specification and documentation for Gendo.
LICENSE Updates the copyright information.
.github/copilot-instructions.md Contains internal Copilot instructions for code review.
Files not reviewed (12)
  • .cursor/rules/development-workflow.mdc: Language not supported
  • .cursor/rules/git-commit-practices.mdc: Language not supported
  • .cursor/rules/llm-integration.mdc: Language not supported
  • .cursor/rules/math-tool.mdc: Language not supported
  • .cursor/rules/project-structure.mdc: Language not supported
  • .cursor/rules/testing-requirements.mdc: Language not supported
  • Makefile: Language not supported
  • examples/calculator.gendo: Language not supported
  • examples/file_processor.gendo: Language not supported
  • examples/hello.gendo: Language not supported
  • examples/random_story.gendo: Language not supported
  • go.mod: Language not supported

}

// Process through the chain of nodes defined in the script
for nodeID := 3; nodeID >= 1; nodeID-- {
Copy link

Copilot AI May 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider refactoring the hard-coded node ID loop into a more flexible mechanism (e.g., iterating based on dynamic node chaining order) to enhance scalability and maintainability.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants