Tool

Load Bitbucket Repositories into Llama Index

LlamaIndex reader that loads a Bitbucket repository's files as indexable documents.

Works with bitbucket

75
Spark score
out of 100
Updated 2 days ago
Version 0.14.23
Models

Add to Favorites

Why it matters

Integrate your Bitbucket code repositories with Llama Index to build powerful RAG applications. Analyze and query your codebase directly.

Outcomes

What it gets done

01

Connect to Bitbucket API using provided credentials.

02

Load repository files as Llama Index Documents.

03

Create a VectorStoreIndex from loaded code documents.

04

Enable querying of your Bitbucket codebase.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/li-reader-readers-bitbucket | bash

Overview

Bitbucket Loader

The Bitbucket Loader pulls a Bitbucket repository's files into LlamaIndex documents via the Bitbucket API, authenticated with an API key and username set as environment variables. Use it when you need a Bitbucket repository's files indexed in LlamaIndex, for example for RAG over a codebase. It requires Bitbucket API credentials.

What it does

The Bitbucket Loader uses the Bitbucket API to load the files inside a Bitbucket repository as documents you can index. It requires two environment variables -- BITBUCKET_API_KEY and BITBUCKET_USERNAME -- to authenticate.

When to use - and when NOT to

Use it when you need to pull a Bitbucket repository's files into a LlamaIndex vector store index -- for example building a RAG system that can answer questions about a codebase. It requires a Bitbucket API key and username set as environment variables, so it is not usable without existing Bitbucket credentials.

Inputs and outputs

Install with:

pip install llama-index-readers-bitbucket

Set your credentials and load a repository's files:

import os
from llama_index.core import VectorStoreIndex, download_loader

os.environ["BITBUCKET_USERNAME"] = "myusername"
os.environ["BITBUCKET_API_KEY"] = "myapikey"

base_url = "https://myserver/bitbucket"
project_key = "mykey"

from llama_index.readers.bitbucket import BitbucketReader

loader = BitbucketReader(
    base_url=base_url,
    project_key=project_key,
    branch="refs/heads/develop",
    repository="ms-messaging",
)
documents = loader.load_data()

index = VectorStoreIndex.from_documents(documents)

BitbucketReader takes a base_url, project_key, branch, and repository to identify which repo and branch to load, and load_data() returns the files as documents ready to index.

Who it's for

Developers building LlamaIndex pipelines -- for example RAG over a codebase -- that need a Bitbucket repository's files loaded as documents.

Source README

Bitbucket Loader

pip install llama-index-readers-bitbucket

This loader utilizes the Bitbucket API to load the files inside a Bitbucket repository as Documents in an index.

Usage

To use this loader, you need to provide as environment variables the BITBUCKET_API_KEY and the BITBUCKET_USERNAME.

import os
from llama_index.core import VectorStoreIndex, download_loader

os.environ["BITBUCKET_USERNAME"] = "myusername"
os.environ["BITBUCKET_API_KEY"] = "myapikey"

base_url = "https://myserver/bitbucket"
project_key = "mykey"

from llama_index.readers.bitbucket import BitbucketReader

loader = BitbucketReader(
    base_url=base_url,
    project_key=project_key,
    branch="refs/heads/develop",
    repository="ms-messaging",
)
documents = loader.load_data()

index = VectorStoreIndex.from_documents(documents)

This loader is designed to be used as a way to load data into Llama Index.

For a step-by-step guide, checkout this tutorial

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.