Skip to main content

Foyle AI

Runme badge

This guide shows you how to use Runme Notebook to run and execute commands and prompts. By integrating Foyle, an AI assistant, you can execute cells containing shell commands or Markdown. However, to perform these actions, Foyle works within the Runme Notebook to enable you to input prompts and display the generated output directly within the Notebook.

This makes it easy to add and run commands, as Foyle can automatically create and execute the necessary cells based on your input. With Runme's interactive notebook, you can perform these operations and view your completed tasks.

Installation

To get started, ensure you have the following installed:

  • Runme Extension

To access the Runme Notebook, install the Runme extension in your VS Code editor. You can also set Runme as your default Markdown viewer.

  • Install Foyle

To install Foyle, follow the steps as instructed here.

Setting Up Foyle with Runme

After successfully installing Foyle, the next step is to set it up. This section will break down the setup process.

  1. Configure Your OpenAPI Key

To kickstart setting up Foyle on your local machine, you will need to configure your OpenAPI key. This will give you access to work with Foyle. Go to OpenAI to obtain your unique API key.

Once you have gotten your key, save it in a plain text file and run the command below.

foyle config set openai.apiKeyFile=/path/to/openai/apikey

open ai key

  1. Start the Server

Run the command below to start the Foyle server on your local machine. However, you must ensure your API Key is in the directory where this command will run. If it isn’t, you can set the directory of your code cell to the directory where your API Key is located using the CWD feature of Runme.

foyle serve

This command should start Foyle in the background. To make it run without disrupting your activities, activate your cell's background task mode. This feature will make Foyle run as a background task without interrupting your progress.

Once that is done, run the cell, and you will get an output similar to the image below.

foyle serve

By default, Foyle uses port 8877 for the HTTP server. You can configure this by running the command below if you would like to use a different port.

export FOYLE_HTTP_PORT=YOUR HTTP PORT
foyle config set server.httpPort=$FOYLE_HTTP_PORT

  1. Confirm Foyle's Address

If you would like to confirm your Foyle Address in VS Code, do the following.

  • Open the VS Code setting palette
  • Search for Runme: Ai Base URL
  • Set the address to http://localhost:${FOYLE_HTTP_PORT}/api. By default, the port is 8877. If you set a non-default value, it will be the value of server.httpPort

Extension Setting

Running Foyle Operations with Runme

Now that Foyle has been successfully installed and set up in your Runme Notebook, we can proceed to test it out by performing some operations, such as asking it questions like we would ask an AI tool.

In this section, we will be performing several operations with Foyle, such as setting up a kind cluster, getting a list of all namespaces in a cluster, and listing and describing pods.

Running a Prompt

With this integration, you can ask a question using Foyle within the Notebook to generate a response. Remember, Foyle allows you to add cells and execute commands within a Notebook.

In the example below, we will demonstrate “How to set up a kind cluster” using Foyle in our Runme Interactive Notebook.

To do this, first, create a new Markdown cell in your Markdown file and type your questions. For instance, in the video below, we will ask Foyle, "How do I set up a kind cluster?"

Foyle will answer the question below.

Executing a Command

When you enter a command in the Notebook, you can run it to get a response. Foyle processes the command and displays the response in the Notebook.

To run the question and get Foyle to answer, press shift + command + p. This will open a dashboard with several options. Select Generate cells using the Foyle assistant.

In the video below, we prompt Foyle to list all pods. Foyle returns the command, which you can run in the Markdown file to get the list of all pods.

Generate Output Based on Previous Command

Additionally, you can also use Foyle to generate output based on your previous commands. Foyle will follow the events from your previous commands or output and return the result in the Notebook.

In the image below, we are asking Foyle to describe a pod from the list of pods we got in the example above.

Output command

Where to go next

Feedback and Contribution

If you have any tool or project you would like to see integrated with Runme, feel free to contact us with your idea. We will be glad to test it out.