github.py


Overview

The github.py file provides a tool integration for searching GitHub repositories programmatically within the InfiniFlow agent framework. It defines the parameters and execution logic required to query the GitHub Search API, retrieve a list of repositories matching a search query, and format the results for further use in the system.

This component enables users or other parts of the application to perform repository searches on GitHub based on user-provided keywords, returning highly starred repositories sorted by popularity. It abstracts the GitHub API details and provides a consistent interface for repository search within InfiniFlow.


Classes and Their Details

GitHubParam

Defines the parameters and metadata for the GitHub search tool component.

Description

Attributes

Methods

Usage Example

param = GitHubParam()
param.top_n = 5
param.check()  # Validates top_n
input_form = param.get_input_form()
# input_form = {
#     "query": {"name": "Query", "type": "line"}
# }

GitHub

Main tool class implementing the GitHub repository search functionality.

Inheritance

Class Attributes

Methods


Important Implementation Details


Interaction with Other System Components


Visual Diagram

classDiagram
    class GitHubParam {
        +meta: ToolMeta
        +top_n: int
        +__init__()
        +check()
        +get_input_form() dict
    }

    class GitHub {
        +component_name: str
        +_invoke(**kwargs) str
        +thoughts() str
    }

    GitHubParam <|-- GitHub
    ToolParamBase <|-- GitHubParam
    ToolBase <|-- GitHub
    GitHub ..> requests
    GitHub ..> timeout

Summary

The github.py file implements a reusable and configurable tool component for searching GitHub repositories by keywords. It manages input parameters, performs authenticated API calls with error handling and retry, and formats results to integrate seamlessly into the InfiniFlow framework. The component’s design cleanly separates parameter definition (GitHubParam) from execution logic (GitHub), enabling easy extension and maintenance.

This tool is instrumental in enabling InfiniFlow agents to incorporate up-to-date GitHub repository data into their workflows, supporting tasks such as code discovery, project analysis, or integration with developer environments.