Urgent.News

What's breaking now, across thousands of outlets.

Tech

Imp is a full port of DSPy to the BEAM

Imp is a complete port of DSPy, a declarative, self-improving language-model programming framework, to the BEAM, Elixir's virtual machine. In Imp, you specify the input and output of each language-model step, choose how it thinks, and an optimizer refines it using examples of desired behavior. This process occurs within the reliability and concurrency guarantees of OTP. Each model call in DSPy is represented as a typed, declared function in Imp, allowing for measurement and improvement.

In the BEAM environment, an agent is a self-contained process, managing its own state, receiving messages, and running alongside other application components within a supervisor. This capability enables building a wide range of applications, from single typed calls to extensive, long-running agents, with the ability to enhance each part by measuring its performance.

Importantly, there is no need to craft prompts or parse data in Imp, as it automatically generates prompts from signatures, validates replies against them, and provides typed fields.

Imp streamlines the reasoning process using the chain_of_thought/2 function and incorporates tools through the react/3 function. The signature for each operation remains consistent, facilitating seamless integration. To guide Imp's learning, provide labeled examples, a metric, and three sets of issues: trainset (for optimization), valset (for selection of programs), and testset (for post-optimization evaluation). These sets are crucial for guiding the optimizer's process.

To enhance the model's capabilities, use a stronger language model, such as GEPA, which analyzes failures and refines instructions. Other optimizers include approaches that learn from labeled examples, search for optimal instruction-example combinations, improve through rule learning, or fine-tune the model's weights. The outcome is a refined program, complete with readable instructions and examples, which can be saved as JSON and reviewed through a diff.

Imp integrates tools as Elixir functions, with its React function building agents that sequentially call these tools to address problems, such as web page reading with Req. The library depends on Req; if your code uses it, ensure to include it in your dependencies list. The call/2 function runs Imp programs within your application process, while call/3 initiates them in a separate, supervised process, offering greater control over execution.

Optimizers in Imp can also refine agents, with GEPA reflecting on entire agent runs and rewriting instructions accordingly. Optimize Anything can modify any text or JSON formatted data based on a defined scoring system. To set up Imp, you need Elixir 1.19 or later, along with a C++ compiler for one dependency, erlexec. Imp currently supports models accessed via ReqLLM, meaning any supported provider will work.

Note that Imp 0.5 is experimental, released on Hex, and its API may still evolve. Additionally, the optimizers benefit from extensive benchmarking to ensure optimal performance. Feedback and contributions are welcomed via bug reports and pull requests.

Written by urgent.news from Hacker News's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at github.com →

More in Tech

Moving off Event Tickets Plus: what your WooCommerce ticket data looks like

Event Tickets Plus sells your event tickets through WooCommerce. If you're moving off it, whether because of the Liquid Web changes or because you're leaving The Events Calendar altogether, the…

  • Event Tickets Plus integrates with WooCommerce for ticket sales
  • Migration pitfalls include unpaid orders and pending statuses
  • Beacon Events Pro handles Event Tickets Plus data import

The A2UI Contract: A Deep Dive into Agent-to-UI Architecture

A2UI answers one design question: what happens when you let a language model design a UI on the fly. It refuses to let the model write a single line of code.

  • Agent decides UI components, communicates via messages
  • Protocol defines description shape, ensures validation
  • Renderer decides UI appearance, runs on client

Cron jobs: the tiny line that runs half your backend

Every backend has a few jobs nobody looks at. The nightly backup. The 9 AM report. The script that deletes old files. Each one is a single line of cron. They work fine for months.

  • Cron jobs are background code lines on Unix machines performing backups, reports, and deletions.
  • Cron job syntax includes minute, hour, day of month, month, day of week, and command.
  • Misunderstanding cron's range and interval syntax can lead to incorrect scheduling.

More from Sunday 27 September →