This document provides a comprehensive reference for the public API of the llama-github
library. It covers the main classes, methods, and their parameters.
The GithubRAG
class is the main entry point for using the llama-github
library. It provides methods for initializing the library, retrieving context, and configuring various aspects of the retrieval process.
__init__(self, github_access_token=None, github_app_credentials=None, openai_api_key=None, huggingface_token=None, jina_api_key=None, open_source_models_hg_dir=None, embedding_model=None, rerank_model=None, llm=None, **kwargs)
Initializes a new instance of the GithubRAG
class.
github_access_token
(str, optional): GitHub access token for authentication. Defaults toNone
.github_app_credentials
(GitHubAppCredentials, optional): Credentials for GitHub App authentication. Defaults toNone
.openai_api_key
(str, optional): API key for OpenAI services. Recommended for using GPT-4-turbo. Defaults toNone
.huggingface_token
(str, optional): Token for Hugging Face services. Recommended. Defaults toNone
.jina_api_key
(str, optional): API key for Jina AI services. Used for high concurrency production deployment. Defaults toNone
.open_source_models_hg_dir
(str, optional): Path to open-source models from Hugging Face to replace OpenAI. Defaults toNone
.embedding_model
(str, optional): Name of the custom embedding model from Hugging Face. Defaults to the value specified in the configuration.rerank_model
(str, optional): Name of the custom reranking model from Hugging Face. Defaults to the value specified in the configuration.llm
(Any, optional): Custom LangChain LLM chat object to replace OpenAI or open-source models from Hugging Face. Defaults toNone
.**kwargs
: Additional keyword arguments for configuring the repository pool caching mechanism.repo_cleanup_interval
(int, optional): Cache cleanup interval in seconds. Defaults to the value specified in the configuration.repo_max_idle_time
(int, optional): Maximum idle time for a cached repository in seconds. Defaults to the value specified in the configuration.
Retrieves relevant context from GitHub based on the provided query.
query
(str): The query or question to retrieve context for.simple_mode
(bool, optional): Flag to enable simple mode retrieval. In simple mode, only a Google search is conducted based on the user's question. Defaults toFalse
.
List[str]
: A list of relevant context strings retrieved from GitHub.
Asynchronously retrieves relevant context from GitHub based on the provided query.
query
(str): The query or question to retrieve context for.simple_mode
(bool, optional): Flag to enable simple mode retrieval. In simple mode, only a Google search is conducted based on the user's question. Defaults toFalse
.
List[str]
: A list of relevant context strings retrieved from GitHub.
The GitHubAppCredentials
class represents the credentials required for authenticating with a GitHub App.
Initializes a new instance of the GitHubAppCredentials
class.
app_id
(int): The ID of the GitHub App.private_key
(str): The private key associated with the GitHub App.installation_id
(int): The ID of the GitHub App installation.
Configures the logging level for the llama-github
library.
level
(int, optional): The desired logging level. Defaults tologging.INFO
.
This API reference provides an overview of the main classes and methods available in the llama-github
library. It serves as a complement to the usage guide and helps developers understand the available functionality and how to interact with the library programmatically.
For more detailed information on how to use these classes and methods, along with code examples, please refer to the usage guide.
If you have any questions or need further assistance, please open an issue on the GitHub repository or reach out to the project maintainers.