Use case scenarios for RAG
Review the following use case scenarios to understand how to configure and use RAG (retrieval augmented generation) with watsonx Code Assistant for various team structures and access requirements.
Overview
The following scenarios demonstrate different ways to configure and use RAG with watsonx Code Assistant based on your team structure and access requirements. Each scenario includes the configuration steps and considerations for implementing RAG effectively.
Using a single code repository
If you are working in a single repository and want to use the code from this repository as context for chat conversations, follow this approach:
Prerequisites:
- You have access to the repository in GitHub.
- You have a Git personal access token from your GitHub account.
Configuration steps:
- Index the repository in the vector store. For more information, see Indexing code repositories and documentation.
- Create a connection asset for the repository. For more information, see Setting up connection assets.
- Complete the Git personal access token setup in Visual Studio Code. For more information, see Setting up retrieval augmented generation (RAG).
- Open the repository in Visual Studio Code.
- Use the
@repocommand in chat to generate responses that use context from the repository.
Using multiple code repositories
If you are working on a repository that has dependencies on other repositories, you can use the code from multiple repositories as context for chat conversations.
Prerequisites:
- You have access to all repositories in GitHub.
- You have a Git personal access token from your GitHub account.
Configuration steps:
- Index each repository in the vector store separately. For more information, see Indexing code repositories and documentation.
- Create a connection asset for each repository. For more information, see Setting up connection assets.
- Complete the Git personal access token setup in Visual Studio Code. For more information, see Setting up retrieval augmented generation (RAG).
- In the primary repository, set up a YAML configuration file that lists all repositories. For more information, see Setting up YAML configuration for RAG.
- Use the
@repocommand in chat to generate responses that use context from all configured repositories.
Enabling all users in a team to access project documentation
You can allow all users in a team to access project documentation repositories and use the documents as context for chat conversations.
Prerequisites:
- All team members have access to the documentation repositories.
- A deployment space exists that includes all team members.
Configuration steps:
- Index the project documentation repositories in the vector store. For more information, see Indexing code repositories and documentation.
- If all users have access to the indexed documentation repositories, you can use the same index for all documentation. If users have access restrictions, see the use case for enabling users in different subteams.
- Create a connection asset for the documentation index in the deployment space that includes all team members. For more information, see Setting up connection assets.
- Use the
@docscommand in chat to generate responses that use context from the documentation index.
Enabling users in different subteams to access project documentation
In this scenario, different subteams within a large team maintain separate project documentation repositories. Access to the documentation repositories is restricted to specific subteams, and other subteams do not have access to these documentation repositories.
Prerequisites:
- Each subteam has its own documentation repositories.
- A deployment space exists for each subteam that includes its members.
Configuration steps:
- Index the documentation repositories separately in the vector store. For more information, see Indexing code repositories and documentation.
- Ensure that a deployment space is created for each subteam that includes its users.
- For each documentation repository index, create a connection asset in the corresponding deployment space. For more information, see Setting up connection assets.
- Use the
@docscommand in chat to generate responses that use context from the documentation index.
watsonx Code Assistant uses the documentation repository index based on the deployment space that is assigned to the users. No client-side configuration is required.
Enabling role-based users to access project documentation
In this scenario, users in a team require access to different sets of documentation based on their roles. The scope of documentation that is used as context varies across users with no access restrictions. For example, developers need technical and API documentation only, while business analysts focus on business process documents.
Prerequisites:
- Documentation is organized by role or function.
- A deployment space exists that includes all team members.
Configuration steps:
- Index each documentation repository in the vector store separately. For more information, see Indexing code repositories and documentation.
- Create a connection asset for each index in the deployment space of the team. For more information, see Setting up connection assets.
- Set up a YAML configuration file for the required documentation indexes that should be used as context. If you need to use multiple documentation indexes, configure each one in the YAML file. For more information, see Setting up YAML configuration for RAG.
- Use the
@docscommand in chat to generate responses that use context from the configured documentation indexes.
What to do next
For more information about setting up RAG, see Setting up retrieval augmented generation (RAG).