Setting up YAML configuration for RAG
You can optionally set up YAML configuration files to allow watsonx Code Assistant to search multiple repositories simultaneously or use specific indexed code repositories or documents in the vector store.
Before you begin
- You have enabled RAG on your IBM® Software Hub instance. For more information, see Setting up retrieval augmented generation (RAG).
- You have indexed your code repositories and documentation. For more information, see Indexing code repositories and documentation.
- You have created connection assets for your indexed repositories. For more information, see Setting up connection assets.
About this task
If you do not set up YAML configuration, watsonx Code Assistant uses the repository that is opened in Visual Studio Code by default. YAML configuration files enable you to:
- Specify multiple repositories to search simultaneously when using the
@repocommand. - Specify multiple document collections to search simultaneously when using the
@docscommand. - Control which repositories or document collections are used for specific projects or contexts.
watsonx Code Assistant uses the GitHub personal access token authorization method to ensure that you can access only the authorized repositories or document collections.
Setting up repositories
- To configure code repositories, complete the steps For code repositories.
- To configure document collections, complete the steps in For document repositories.
For code repositories
- In your code repository, create a .wca/repo directory at the root level.
- In the .wca/repo directory, create a repo.yaml file.
- Add the repository URLs to the repo.yaml file using the following
format:
Replace the example URLs with the URLs of your repositories.repo: - url: git@github.ibm.com:code-assistant/my-code.git - url: git@github.ibm.com:code-assistant/my-dependencies.git - Save the repo.yaml file.
When you use the
@repocommand in chat, watsonx Code Assistant searches all the repositories listed in the repo.yaml file. - If you have multiple repositories that depend on each other, create a
repo.yaml file in each repository that needs to reference other
repositories.Note: Each repository can have its own repo.yaml file that specifies which other repositories to include in the search context.
For document repositories
- In your code repository, create a .wca/docs directory at the root level.
- In the .wca/docs directory, create a docs.yaml file.
- Add the document collection names to the docs.yaml file using the following
format:
Replace the example collection names with the names of your document collections. These names must match the connection asset names you created.docs: - collection: docs_technical_guides - collection: docs_api_documentation - collection: docs_design_documents - Save the docs.yaml file.
When you use the
@docscommand in chat, watsonx Code Assistant searches all the document collections listed in the docs.yaml file.
Results
After you set up the YAML configuration files, watsonx Code
Assistant uses the configured
repositories or document collections when you use the @repo or
@docs commands in chat. This enables you to search across multiple repositories or
document collections simultaneously without manually specifying each one.
What to do next
Test your YAML configuration by using the @repo or @docs
commands in Visual Studio Code chat. For more
information about using RAG, see Setting up retrieval augmented generation (RAG).