# How LLama-GitHub Transforms Issue Search API URLs to Web URLs

> Discover how LLama-GitHub efficiently transforms GitHub API issue search URLs to web URLs by replacing api.github.com with github.com, simplifying your workflow.

- Repository: [Jet Xu/llama-github](https://github.com/jetxu-llm/llama-github)
- Tags: how-to-guide
- Published: 2026-03-04

---

**LLama-GitHub converts GitHub's machine-readable API endpoints into browser-friendly web URLs by replacing `api.github.com/repos` with `github.com` while preserving the issue path structure.**

When the RAG pipeline executes an issue search against the GitHub Search Issues API, it receives JSON responses containing `url` fields that point to API endpoints rather than human-readable web pages. The library handles this **issue search URL transformation** internally to ensure users receive clickable links to standard GitHub issue pages.

## The API URL Format

The GitHub Search Issues API returns results with `url` fields following this pattern:

```

https://api.github.com/repos/<owner>/<repo>/issues/123

```

While functional for programmatic access, these URLs return raw JSON data when accessed in a browser. To make results usable for end-users, LLama-GitHub rewrites these strings to the public web format:

```

https://github.com/<owner>/<repo>/issues/123

```

## Issue Search URL Transformation Implementation

The transformation logic resides in the `issue_search_retrieval` coroutine within the RAG processing layer.

### Source Code Location

According to the LLama-GitHub source code, the URL rewrite occurs at lines 311-317 in [`llama_github/github_rag.py`](https://github.com/jetxu-llm/llama-github/blob/main/llama_github/github_rag.py):

```python

# llama_github/github_rag.py, lines 311-317

api_url = d["url"]
if api_url not in seen:
    seen.add(api_url)
    # Transform the API URL to the official GitHub issue webpage URL

    html_url = api_url.replace(
        'api.github.com/repos', 'github.com').replace('issues/', 'issues/')
    d["url"] = html_url
    unique_list.append(d)

```

### Step-by-Step Transformation Process

The transformation employs two sequential string replacement operations:

1. **Host and path prefix replacement** – The substring `api.github.com/repos` becomes `github.com`, converting the API endpoint to the web domain.
2. **Path segment safeguard** – The second `.replace('issues/', 'issues/')` operation acts as a defensive measure that leaves the `/issues/` path intact, ensuring the URL structure remains valid even if future modifications affect the path.

**Example transformation:**

```python

# Raw API result from GitHub search

raw_api_url = "https://api.github.com/repos/jetxu-llm/llama-github/issues/42"

# Transformation performed by issue_search_retrieval

web_url = raw_api_url.replace('api.github.com/repos', 'github.com').replace('issues/', 'issues/')

# Result: "https://github.com/jetxu-llm/llama-github/issues/42"

```

## Integration with the Search Pipeline

The URL transformation occurs downstream of the actual API call. The `search_issues` method in [`llama_github/github_integration/github_auth_manager.py`](https://github.com/jetxu-llm/llama-github/blob/main/llama_github/github_integration/github_auth_manager.py) (lines 163-174) executes the initial search against `https://api.github.com/search/issues`, returning raw API responses. The `issue_search_retrieval` coroutine then processes these results, applying deduplication via a `seen` set and performing the URL conversion before appending items to the final result list.

This architecture separates authentication and API communication from data normalization, keeping the transformation logic centralized within the RAG retrieval layer.

## Summary

- **Primary transformation**: Replace `api.github.com/repos` with `github.com` to convert API endpoints to web URLs.
- **Implementation location**: [`llama_github/github_rag.py`](https://github.com/jetxu-llm/llama-github/blob/main/llama_github/github_rag.py) inside the `issue_search_retrieval` method (lines 311-317).
- **Defensive coding**: The second replace operation on `issues/` serves as a safeguard rather than a functional change.
- **Pipeline flow**: [`github_auth_manager.py`](https://github.com/jetxu-llm/llama-github/blob/main/github_auth_manager.py) handles API queries, while [`github_rag.py`](https://github.com/jetxu-llm/llama-github/blob/main/github_rag.py) normalizes results for user consumption.

## Frequently Asked Questions

### Why does LLama-GitHub need to transform API URLs?

The GitHub Search Issues API returns machine-readable JSON endpoints that require authentication headers and return structured data rather than HTML. Transforming these to `github.com` URLs allows the RAG pipeline to present human-readable links that users can open directly in browsers without API credentials.

### What is the purpose of the second replace operation on the issues path?

The `.replace('issues/', 'issues/')` operation is a defensive safeguard that ensures the URL structure remains intact. While it does not change the string content in the current implementation, it protects against potential future path modifications that could otherwise break the issue URL format.

### Where does the original issue search data originate?

The raw API data comes from [`llama_github/github_integration/github_auth_manager.py`](https://github.com/jetxu-llm/llama-github/blob/main/llama_github/github_integration/github_auth_manager.py), specifically the `search_issues` method (lines 163-174), which queries the `https://api.github.com/search/issues` endpoint using authenticated requests managed by the library's auth manager.