Skip to content

Commit

Permalink
Enable RAG by default (#240)
Browse files Browse the repository at this point in the history
* Update the RAG learning docs to reflect the changes
  * RAG is enabled by default
  * You don't need to enable AILogs in RunMe
* You don't need to configure the location of the RunMe logs Related to
#224

Render the navigation sidebar in compact mode.
  • Loading branch information
jlewi authored Sep 14, 2024
1 parent 8c57b00 commit 2bbed97
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 83 deletions.
4 changes: 4 additions & 0 deletions app/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ const (
// https://github.com/stateful/vscode-runme/blob/f1cc965ab0c4cdffa9adb70922e2da792d7e23de/package.json#L849
// The value isn't 8080 because 8080 is over used and likely to conflict with other locally running services.
defaultHTTPPort = 8877

defaultRagEnabled = true
)

// Config represents the persistent configuration data for Foyle.
Expand Down Expand Up @@ -463,6 +465,8 @@ func setServerDefaults() {

func setAgentDefaults() {
viper.SetDefault("agent.model", DefaultModel)
viper.SetDefault("agent.rag.enabled", defaultRagEnabled)
viper.SetDefault("agent.rag.maxResults", defaultMaxResults)
}

func DefaultConfigFile() string {
Expand Down
81 changes: 0 additions & 81 deletions docs/content/en/docs/learning/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,84 +3,3 @@ title: "Learning"
description: "How to use Foyle to learn from human feedback"
weight: 2
---

## What You'll Learn

How to configure Foyle to continually learn from human feedback

## Configure Foyle to use RAG

To configure Foyle to use RAG

```
foyle config set agent.rag.enabled=true
foyle config set agent.rag.maxResults=3
```

## Enabling Logging In RunMe

If you are using [RunMe.dev](https://runme.dev/) as the frontend for Foyle
then you need to configure RunMe to enable the AI logging experiment

1. Inside vscode open the settings panel
2. Enable the option `Runme › Experiments: Ai Logs`

Now that logging is enabled. You can verify that the logs are being written and identify the location
of the logs.

Inside VSCode open an output window and select the **RunMe** output channel.
Scroll to the top of the messages and look for a `Logger initialized` message like the one below

```
[2024-05-28T22:12:20.681Z] INFO Runme(RunmeServer): {"level":"info","ts":1716934340.6789708,"caller":"cmd/common.go:190","msg":"Logger initialized","devMode":false,"aiLogs":true,"aiLogFile":"/Users/jlewi/Library/Application Support/runme/logs/logs.2024-05-28T15:12:20.json"}
```

The field `aiLogs` will contain the file that the current instance of RunMe is using for the JSON logs.

By default, on MacOs RunMe will use the directory

```bash
/Users/${USER}/Library/Application Support/runme/logs/
```

## Configuring Learning

If you are using [RunMe.dev](https://runme.dev/) as the frontend for Foyle
then you need to configure Foyle with the location of the **directory** of RunMe's logs.
Refer to the previous section for instructions on how to locate the file
where `RunMe` is writing the logs. Then remove the filename to get the directory
where the logs are being written.

Once you know the directory run the following command to configure Foyle to use that
directory

```bash
foyle config set learner.logDirs=${RUNME_LOGS_DIR}
```

## Sharing Learned Examples

In a team setting, you should build a shared AI that learns from the feedback of all team members and assists
all members. To do this you can configure Foyle to write and read examples from a shared location like GCS.
If you'd like S3 support please vote up [issue #153](https://github.com/jlewi/foyle/issues/153).

To configure Foyle to use a shared location for learned examples

1. Create a GCS bucket to store the learned examples

```bash
gsutil mb gs://my-foyle-examples
```

1. Configure Foyle to use the GCS bucket

```bash
foyle config set learner.exampleDirs=gs://${YOUR_BUCKET}
```

Optionally you can configure Foyle to use a local location as well if you want to be able to use the AI without
an internet connection.

```bash
foyle config set learner.exampleDirs=gs://${YOUR_BUCKET},/local/training/examples
```
66 changes: 66 additions & 0 deletions docs/content/en/docs/learning/configuring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
title: "Configuring"
description: "Configuring Learning In Foyle"
weight: 1
---

## What You'll Learn

How to configure Learning in Foyle to continually learn from human feedback

## How It Works

* As you use Foyle, the AI builds a dataset of examples (input, output)
* The input is a notebook at some point in time , `t`
* The output is one more or cells that were then added to the notebook at time `t+1`
* Foyle uses these examples to get better at suggesting cells to insert into the notebook

## Configuring RAG

Foyle uses RAG to improve its predictions using its existing dataset of examples. You can control
the number of RAG results used by Foyle by setting `agent.rag.maxResults`.

```
foyle config set agent.rag.maxResults=3
```

## Disabling RAG

RAG is enabled by default. To disable it run

```
foyle config set agent.rag.enabled=false
```

To check the status of RAG get the current configuration

```
foyle config get
```

## Sharing Learned Examples

In a team setting, you should build a shared AI that learns from the feedback of all team members and assists
all members. To do this you can configure Foyle to write and read examples from a shared location like GCS.
If you'd like S3 support please vote up [issue #153](https://github.com/jlewi/foyle/issues/153).

To configure Foyle to use a shared location for learned examples

1. Create a GCS bucket to store the learned examples

```bash
gsutil mb gs://my-foyle-examples
```

1. Configure Foyle to use the GCS bucket

```bash
foyle config set learner.exampleDirs=gs://${YOUR_BUCKET}
```

Optionally you can configure Foyle to use a local location as well if you want to be able to use the AI without
an internet connection.

```bash
foyle config set learner.exampleDirs=gs://${YOUR_BUCKET},/local/training/examples
```
2 changes: 1 addition & 1 deletion docs/content/en/docs/learning/troubleshoot_learning.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Troubleshoot Learning"
description: "How to troubleshoot and monitor learning"
weight: 1
weight: 2
---

## What You'll Learn
Expand Down
2 changes: 1 addition & 1 deletion docs/hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ navbar_logo = true
# Set to true if you don't want the top navbar to be translucent when over a `block/cover`, like on the homepage.
navbar_translucent_over_cover_disable = false
# Enable to show the side bar menu in its compact state.
sidebar_menu_compact = false
sidebar_menu_compact = true
# Set to true to hide the sidebar search box (the top nav search box will still be displayed if search is enabled)
sidebar_search_disable = false

Expand Down

0 comments on commit 2bbed97

Please sign in to comment.