This is the multi-page printable view of this section. Click here to print.
Getting Started
1 - Getting Started 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.
- If you don’t have VSCode visit the downloads page and install it
- Follow Runme.dev instructions to install the RunMe.dev extension in vscode
Install Foyle
Download the latest release from the releases page
On Mac you may need to remove the quarantine attribute from the binary
xattr -d com.apple.quarantine /path/to/foyle
Setup
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
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>
Inside VSCode configure RunMe to use Foyle
- Open the VSCode settings palette
- Search for
Runme > Experiments: Ai Auto Cell
- Check the box to set the option to true
- Search for
Runme: Ai Base URL
- 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.
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
- right click on the file and select “Open With”
- Select the option “Run your markdown” to open it with RunMe
You can now add code and notebook cells like you normally would in vscode
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
- Open the command pallet and search for
Customizing Foyle VSCode Extension Settings
Customizing the Foyle Server Address
- Open the settings panel; you can click the gear icon in the lower left window and then select settings
- Search for `Runme: Ai base URL
- 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
- Click the gear icon in the lower left window and then select “Keyboard shortcuts”
- Search for “Foyle”
- Change the keybinding for
Foyle: generate a completion
to the keybinding you want to use
Where to go next
- Learning from feedback - How to improve the AI with human feedback.
2 - 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.
- If you don’t have VSCode visit the downloads page and install it
- 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
- Open the VSCode setting palette
- Search for
Runme: Ai Base URL
- 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