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

Before you set up YAML configuration, ensure that you meet the following requirements:

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 @repo command.
  • Specify multiple document collections to search simultaneously when using the @docs command.
  • 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

Determine whether you need to configure YAML files for code repositories, document collections, or both.

For code repositories

  1. In your code repository, create a .wca/repo directory at the root level.
  2. In the .wca/repo directory, create a repo.yaml file.
  3. Add the repository URLs to the repo.yaml file using the following format:
    repo:
      - url: git@github.ibm.com:code-assistant/my-code.git
      - url: git@github.ibm.com:code-assistant/my-dependencies.git
    Replace the example URLs with the URLs of your repositories.
  4. Save the repo.yaml file.

    When you use the @repo command in chat, watsonx Code Assistant searches all the repositories listed in the repo.yaml file.

  5. 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

  1. In your code repository, create a .wca/docs directory at the root level.
  2. In the .wca/docs directory, create a docs.yaml file.
  3. Add the document collection names to the docs.yaml file using the following format:
    docs:
      - collection: docs_technical_guides
      - collection: docs_api_documentation
      - collection: docs_design_documents
    Replace the example collection names with the names of your document collections. These names must match the connection asset names you created.
  4. Save the docs.yaml file.

    When you use the @docs command 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).