Skip to content

Configuration

Yiannis Charalambous edited this page Jan 31, 2024 · 10 revisions

Introduction

There are two files that ESBMC-AI uses to store configuration data. The environment file and the config.json file.

Environment Configuration

ESBMC-AI uses environment variables to load API keys and other information not stored in the configuration JSON file. There is a template .env.example file provided that can be used as a starting point for creating the .env file. The template can be found here. ESBMC-AI uses by default the system's environment files, if any variables are missing, then it checks in other locations. The checks occur as follows:

  1. System environment variables.
  2. .env file in the current directory, moving upwards in the directory tree.
  3. esbmc-ai.env file in the current directory, moving upwards in the directory tree.
  4. esbmc-ai.env file in $HOME/.config/ for Linux/macOS and %userprofile% for Windows.

ESBMC-AI be configured with the following environment variables:

The following variables are accepted:

  • OPENAI_API_KEY: API key for interacting with OpenAI services.
  • HUGGINGFACE_API_KEY: API key for interacting with Hugging Face services.
  • ESBMC_AI_CFG_PATH: Location of ESBMC AI configuration file. This can be a relative or absolute path to ESBMC-AI JSON config. ESBMC_AI_CFG_PATH undergoes tilde user expansion and also environment variable expansion.

JSON Configuration

The config.json file contains various different config entries for customizing the behavior of ESBMC-AI. Generally, these options are not secret, as compared to the ENV configuration. So, the JSON configuration is shareable. The default configuration state can be found here.

Config Fields

The following section will describe the JSON configuration's acceptable fields and values. The layout of the following subsections will follow a format of levels, where the root object is the topmost level in the configuration.

Root Object

The root object can contain the following entries:

Object

  • ai_model: What is the default AI model to use? Valid AI models are built-in AI models and models defined in ai_custom.
  • ai_custom: See AI Custom
  • chat_modes: See Chat Modes

Array

  • esbmc_params: An array of parameters that will be used by ESBMC in most scenarios (User Chat Mode, Fix Code Mode).

Boolean

  • allow_successful: If set to true, ESBMC-AI will not produce an error and exit if the source code does not compile.
  • temp_auto_clean: Should the temp directory be deleted after ESBMC-AI ends?
  • loading_hints: Display nice loading animations while waiting.

Integer

  • consecutive_prompt_delay: Sleep between API calls, this is useful to rate limit calls to servers to prevent overloading them.

String

  • esbmc_path: Path to the ESBMC binary. The path undergoes tilde and environment variable expansion, so ~ and environment variables can be specified.
  • temp_file_dir: Which directory should ESBMC-AI put temporary files inside?

AI Custom

Object

Array

Boolean

Integer

String

Chat Modes

Chat modes config describes the system messages, and initial prompts that are going to be used in different modes and scenarios during ESBMC-AI execution. The following describes the Chat Modes JSON structure in the config:

Object

Array

Boolean

Integer

String

Template Values

Template values are used in the config to specify locations where data should be placed. The following values are accepted:

TBD

Dynamic Prompts

Cite paper

Available Scenarios

TBD