org.llm4s.codegen

Members list

Type members

Classlikes

Example demonstrating how to use the CodeWorker to perform code tasks.

Example demonstrating how to use the CodeWorker to perform code tasks.

The workspace runner runs each command without a shell, and only programs on its allowlist (#1756). sbt is not on the default list, so this example adds it with CodeWorker's extraAllowedCommands, which the container receives as WORKSPACE_EXTRA_COMMANDS=sbt. An added program has no option rules of its own: sbt run runs the project's code, so add a build tool only for a workspace you are prepared to let the agent build and run.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
case class CodeTask(description: String, maxSteps: Option[Int], sourceDirectory: Option[String])

Represents a code task to be performed by the CodeWorker.

Represents a code task to be performed by the CodeWorker.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class CodeTaskResult(success: Boolean, message: String, logs: Seq[String])

Represents the result of a code task execution.

Represents the result of a code task execution.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
class CodeWorker(sourceDirectory: String, imageName: String, hostPort: Int, client: LLMClient, extraAllowedCommands: Set[String]) extends AutoCloseable

A worker for code generation and manipulation tasks. CodeWorker combines a workspace environment with an LLM agent to handle tasks involving code base understanding, modification, and generation.

A worker for code generation and manipulation tasks. CodeWorker combines a workspace environment with an LLM agent to handle tasks involving code base understanding, modification, and generation.

The agent's commands run in the container without a shell, and only programs on the runner's allowlist run (#1756); a build tool the task needs, such as sbt, goes in extraAllowedCommands.

Value parameters

client

The LLM that drives the agent

extraAllowedCommands

Programs the runner may run besides its default allowlist, for example Set("sbt")

hostPort

The host port for the container

imageName

The workspace-runner image

sourceDirectory

The directory containing the codebase to work with

Attributes

Supertypes
trait AutoCloseable
class Object
trait Matchable
class Any

PureConfig-based loader for workspace settings.

PureConfig-based loader for workspace settings.

This mirrors the behavior of WorkspaceSettings.load(), but is implemented in terms of llm4s.* HOCON keys and the standard PureConfig flow.

Keys (with precedence):

  • llm4s.workspace.dir | WORKSPACE_DIR
  • llm4s.workspace.image | WORKSPACE_IMAGE
  • llm4s.workspace.port | WORKSPACE_PORT

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
final case class WorkspaceSettings(workspaceDir: String, imageName: String, hostPort: Int)

Configuration settings for workspace environment.

Configuration settings for workspace environment.

Defines the directory, Docker image, and port configuration for the containerized code workspace.

Value parameters

hostPort

host port for workspace communication

imageName

Docker image name for the workspace container

workspaceDir

directory path containing the codebase to work with

Attributes

See also

WorkspaceConfigSupport for loading settings from configuration

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Companion object with default workspace settings.

Companion object with default workspace settings.

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type