diff --git a/.devcontainer/raft/Dockerfile b/.devcontainer/raft/Dockerfile new file mode 100644 index 000000000..2b90bfef2 --- /dev/null +++ b/.devcontainer/raft/Dockerfile @@ -0,0 +1,4 @@ +FROM mcr.microsoft.com/devcontainers/python:1-3.10 + +RUN curl -sfL https://direnv.net/install.sh | bash && \ + echo 'eval "$(direnv hook bash)"' >> /etc/bash.bashrc diff --git a/.devcontainer/raft/devcontainer.json b/.devcontainer/raft/devcontainer.json new file mode 100644 index 000000000..b3d6455f9 --- /dev/null +++ b/.devcontainer/raft/devcontainer.json @@ -0,0 +1,32 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/python +{ + "name": "RAFT", + + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "build": { + // Path is relative to the devcontainer.json file. + "dockerfile": "Dockerfile" + }, + + // Features to add to the dev container. More info: https://containers.dev/features. + "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "sh ${containerWorkspaceFolder}/.devcontainer/raft/post-create.sh", + + // Configure tool-specific properties. + "customizations": { + "codespaces": { + "openFiles": [ + "raft/README.md" + ] + } + } + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.devcontainer/raft/post-create.sh b/.devcontainer/raft/post-create.sh new file mode 100755 index 000000000..3c6667cd4 --- /dev/null +++ b/.devcontainer/raft/post-create.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +cd raft + +echo "Allowing raft direnv" +direnv allow + +echo "Creating virtual environment" +python3 -m venv .venv +. ./.venv/bin/activate + +echo "Upgrading pip" +pip install --upgrade pip + +echo "Installing requirements" +pip install -r requirements.txt diff --git a/raft/.envrc b/raft/.envrc new file mode 100644 index 000000000..9690fa115 --- /dev/null +++ b/raft/.envrc @@ -0,0 +1,3 @@ +# Tell direnv to use pre configured venv +export VIRTUAL_ENV=./.venv +layout python diff --git a/raft/.gitignore b/raft/.gitignore new file mode 100644 index 000000000..21d0b898f --- /dev/null +++ b/raft/.gitignore @@ -0,0 +1 @@ +.venv/ diff --git a/raft/README.md b/raft/README.md index 2d406fa36..7e4e3e817 100644 --- a/raft/README.md +++ b/raft/README.md @@ -4,6 +4,14 @@ RAFT is a recipe to adapting LLMs to domain-specific RAG. You can learn more in The input data from the user can be either a general text document (pdf, json, or txt) for general QA or an API documentation in the API Zoo JSONL format for API calling. +## Dev environment with Codespaces + +[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/ShishirPatil/gorilla/tree/codespaces?devcontainer_path=.devcontainer%2Fraft%2Fdevcontainer.json) + +Everything is setup automatically in the dev container, open a terminal into the `raft` folder: + +Note: The `raft` virtual env will be activated in your shell when entering into the `raft` folder. + ## Install Dependencies Dependencies can be installed using the following command: