Tool

Integrate GitLab Data with LlamaIndex

LlamaIndex readers that load GitLab repository files and issues via python-gitlab.

Works with gitlab

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

Add to Favorites

Why it matters

Connect your GitLab projects and issues to LlamaIndex for advanced data analysis and retrieval. Leverage your code repositories and issue tracking data within your AI applications.

Outcomes

What it gets done

01

Read files from GitLab repositories by branch or commit.

02

Fetch open issues from specific GitLab projects.

03

Retrieve issues from GitLab groups.

04

Integrate GitLab data into LlamaIndex for RAG.

Install

Add it to your toolbox

Run in your project directory:

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

Overview

LlamaIndex Readers Integration: Gitlab

The GitLab Readers package uses python-gitlab to load repository files or issues into LlamaIndex, via two readers: GitLabRepositoryReader for files by branch or commit, and GitLabIssuesReader for issues by project or group. Use it when you need GitLab repository files or issues loaded into LlamaIndex. Private groups and projects require an access or OAuth token.

What it does

The GitLab Readers package uses python-gitlab to pull content from GitLab projects, via two separate readers: GitLabRepositoryReader (reads through files in a repo by branch or commit) and GitLabIssuesReader (loads issues, either by project ID or by group ID). An access token or OAuth token is required for private groups and projects.

When to use - and when NOT to

Use it when you need GitLab repository files or issues loaded into LlamaIndex documents -- for example a specific file at a given branch, or all open issues across a project or group. It requires a GitLab client (gitlab.Gitlab(...)) and, for private groups or projects, an access or OAuth token, so it is not usable against private content without one.

Inputs and outputs

Install with:

pip install llama-index-readers-gitlab

For repository files:

import gitlab
from llama_index.readers.gitlab import GitLabRepositoryReader

gitlab_client = gitlab.Gitlab("https://gitlab.com")

project_repo_reader = GitLabRepositoryReader(
    gitlab_client=gitlab_client,
    project_id=project_id,
    verbose=True,
)

docs = project_repo_reader.load_data(file_path="README.rst", ref="develop")

For issues, by project or by group:

import gitlab
from llama_index.readers.gitlab import GitLabIssuesReader

gitlab_client = gitlab.Gitlab("https://gitlab.com")

### load issues by project id
project_issues_reader = GitLabIssuesReader(
    gitlab_client=gitlab_client,
    project_id=project_id,
    verbose=True,
)

docs = project_issues_reader.load_data(
    state=GitLabIssuesReader.IssueState.OPEN
)

### load issues by group id
group_issues_reader = GitLabIssuesReader(
    gitlab_client=gitlab_client,
    group_id=group_id,
    verbose=True,
)

docs = group_issues_reader.load_data(state=GitLabIssuesReader.IssueState.OPEN)

Who it's for

Developers building LlamaIndex pipelines that need GitLab repository content or issue tracking data, at either the project or group level.

Source README

LlamaIndex Readers Integration: Gitlab

pip install llama-index-readers-gitlab

The gitlab readers package leverages python-gitlab to fetch contents from gitlab projects. It consists of two separate readers:

  1. Repository Reader
  2. Issues Reader

Access token or oauth token is required for private groups and projects.

Repository Reader

This reader will read through files in a repo based on branch or commit.

import gitlab
from llama_index.readers.gitlab import GitLabRepositoryReader

gitlab_client = gitlab.Gitlab("https://gitlab.com")

project_repo_reader = GitLabRepositoryReader(
    gitlab_client=gitlab_client,
    project_id=project_id,
    verbose=True,
)

docs = project_repo_reader.load_data(file_path="README.rst", ref="develop")

Issues Reader

import gitlab
from llama_index.readers.gitlab import GitLabIssuesReader

gitlab_client = gitlab.Gitlab("https://gitlab.com")

### load issues by project id
project_issues_reader = GitLabIssuesReader(
    gitlab_client=gitlab_client,
    project_id=project_id,
    verbose=True,
)

docs = project_issues_reader.load_data(
    state=GitLabIssuesReader.IssueState.OPEN
)

### load issues by group id
group_issues_reader = GitLabIssuesReader(
    gitlab_client=gitlab_client,
    group_id=group_id,
    verbose=True,
)

docs = group_issues_reader.load_data(state=GitLabIssuesReader.IssueState.OPEN)

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.