This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Getting Started

Getting started with Foyle

1 - Getting Started Locally

Getting started with Foyle Locally

Deploying Foyle locally is the quickest, easiest way to try out Foyle.

Installation

Prerequisites: VSCode & RunMe

Foyle relies on VSCode and Runme.dev to provide the frontend.

  1. If you don’t have VSCode visit the downloads page and install it
  2. Follow Runme.dev instructions to install the RunMe.dev extension in vscode

Install Foyle

  1. Download the latest release from the releases page

  2. On Mac you may need to remove the quarantine attribute from the binary

    xattr -d com.apple.quarantine /path/to/foyle
    

Setup

  1. Configure your OpenAPI key

    foyle config set openai.apiKeyFile=/path/to/openai/apikey
    
    • If you don’t have a key, go to OpenAI to obtain one
  2. Start the server

    foyle serve
    
    • By default foyle uses port 8877 for the http server

    • If you need to use a different port you can configure this as follows

    foyle config set server.httpPort=<YOUR HTTP PORT>
    
  3. Inside VSCode configure RunMe to use Foyle

    1. Open the VSCode setting palette
    2. Search for Runme: Ai Base URL
    3. Set the address to http://localhost:${HTTP_PORT}/api
      • The default port is 8877
      • If you set a non default value then it will be the value of server.httpPort

Try it out!

Now that foyle is running you can open markdown documents in VSCode and start interacting with foyle.

  1. Inside VSCode Open a markdown file or create a notebook; this will open the notebook inside RunMe

    • Refer to RunMe’s documentation for a walk through of RunMe’s UI
    • If the notebook doesn’t open in RunMe
      1. right click on the file and select “Open With”
      2. Select the option “Run your markdown” to open it with RunMe
  2. You can now add code and notebook cells like you normally would in vscode

  3. To ask Foyle for help do one of the following

    • Open the command pallet and search for Foyle generate a completion
    • Use the shortcut key:
      • “win;” - on windows
      • “cmd;” - on mac

Customizing Foyle VSCode Extension Settings

Customizing the Foyle Server Address

  1. Open the settings panel; you can click the gear icon in the lower left window and then select settings
  2. Search for `Runme: Ai base URL
  3. Set Runme: Ai base URL to the address of the Foyle server to use as the Agent
    • The Agent handles requests to generate completions

Customizing the keybindings

If you are unhappy with the default key binding to generate a completion you can change it as follows

  1. Click the gear icon in the lower left window and then select “Keyboard shortcuts”
  2. Search for “Foyle”
  3. Change the keybinding for Foyle: generate a completion to the keybinding you want to use

Where to go next

2 - Deploying Foyle on Kubernetes

Deploying Foyle on Kubernetes

Deploying Foyle on Kubernetes is the recommended way for teams to have a shared instance that transfers knowledge across the organization.

Installation

Prerequisites: VSCode & RunMe

Foyle relies on VSCode and RunMe.dev to provide the frontend.

  1. If you don’t have VSCode visit the downloads page and install it
  2. Follow RunMe.dev instructions to install the RunMe.dev extension in vscode

Deploy Foyle on Kubernetes

Create the namespace foyle

kubectl create namespace foyle

Clone the foyle repository to download a copy of the kustomize package

git clone https://github.com/jlewi/foyle.git

Deploy foyle

cd foyle
kustomize build manifests | kubectl apply -f -

Create a secret with your OpenAI API key

kubectl create secret generic openai-key --from-file=openai.api.key=/PATH/TO/YOUR/OPENAI/APIKEY -n foyle

Verify its working

Check the pod is running

kubectl get pods -n foyle

NAME      READY   STATUS    RESTARTS   AGE
foyle-0   1/1     Running   0          58m

Port forward to the pod

kubectl -n foyle port-forward foyle-0 8877:8877

Verify the service is accessible and healthy

curl http://localhost:8877/healthz

{"server":"foyle","status":"healthy"}

Expose the service on your VPN

At this point you should customize the K8s service to make it accessible from employee machines over your VPN. While you could use it via kubectl port-forward that isn’t a very good user experience. If your looking for a VPN its hard to beat Tailscale.

Configure Runme

Inside VSCode configure Runme to use Foyle

  1. Open the VSCode setting palette
  2. Search for Runme: Ai Base URL
  3. Set the address to http://${HOST}:${PORT}/api
  • The value of host and port will depend on how you make it accessible over vpn
  • The default port is 8877