Skip to content

Commit

Permalink
Merge pull request #36 from r-world-devs/maciekbanas/15/complete-docu…
Browse files Browse the repository at this point in the history
…mentation-of-functions

Add docs and roxygenize package.
  • Loading branch information
maciekbanas authored Nov 19, 2024
2 parents 6d5f3f2 + 3df4386 commit 8909de8
Show file tree
Hide file tree
Showing 14 changed files with 153 additions and 19 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: GitAI
Title: Extracts Knowledge From Git Repositories
Version: 0.0.0.9002
Version: 0.0.0.9003
Authors@R: c(
person("Kamil", "Wais", , "[email protected]", role = c("aut", "cre")),
person("Maciej", "Banas", , "[email protected]", role = "aut")
Expand Down
7 changes: 7 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
# Generated by roxygen2: do not edit by hand

export(add_files)
export(initialize_project)
export(process_repos)
export(set_github_repos)
export(set_gitlab_repos)
export(set_llm)
export(set_prompt)
3 changes: 3 additions & 0 deletions R/add_files.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#' Add files to `GitAI` object.
#' @name add_files
#' @param gitai A \code{GitAI} object.
#' @param files A character vector of file paths. May be defined with
#' regular expression.
#' @return A \code{GitAI} object.
#' @export
add_files <- function(gitai, files) {
if (!is.null(files)) {
Expand Down
5 changes: 4 additions & 1 deletion R/initialize_project.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#' export
#' Initialize a `GitAI` project.
#' @param project_id A character, ID of the project.
#' @return A \code{GitAI} object.
#' @export
initialize_project <- function(project_id) {

GitAI$new(project_id = project_id)
Expand Down
6 changes: 3 additions & 3 deletions R/process_repos.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#' Run LLM on `GitAI` repositories content
#' @name process_repos
#' @param gitai A GitAI object.
#'
#' @param gitai A \code{GitAI} object.
#' @return A list.
#' @export

process_repos <- function(gitai) {

gitstats <- gitai$gitstats
Expand Down
22 changes: 17 additions & 5 deletions R/set_llm.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
#' export
set_llm <- function(gitai,
#' Set Large Language Model in `GitAI` object.
#' @name set_llm
#' @param gitai A \code{GitAI} object.
#' @param provider A LLM provider.
#' @param model A LLM model.
#' @param seed An integer to make results more reproducible.
#' @return A \code{GitAI} object.
#' @export
set_llm <- function(gitai,
provider = "openai",
model = "gpt-4o-mini",
seed = NULL,
...) {

if (provider == "openai") {

gitai$llm <- elmer::chat_openai(
Expand All @@ -18,9 +25,14 @@ set_llm <- function(gitai,
invisible(gitai)
}

#' export
#' Set prompt.
#' @name set_prompt
#' @param gitati A \code{GitAI} object.
#' @param system_prompt A system prompt.
#' @return A \code{GitAI} object.
#' @export
set_prompt <- function(gitai, system_prompt) {

gitai$system_prompt <- system_prompt
invisible(gitai)
}
}
8 changes: 6 additions & 2 deletions R/set_repos.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#' Set GitHub repositories in `GitAI` object.
#' @name set_github_repos
#' @param gitai A GitAI object.
#' @param gitai A \code{GitAI} object.
#' @param host A character, GitHub host.
#' @param repos A character vector or repositories full names.
#' @return A \code{GitAI} object.
#' @export
set_github_repos <- function(gitai,
host = NULL,
Expand All @@ -20,10 +22,12 @@ set_github_repos <- function(gitai,
invisible(gitai)
}

#' Set GitLab repositories in `GitAI` object.
#' @name set_gitlab_repos
#' @param gitai A GitAI object.
#' @param gitai A \code{GitAI} object.
#' @param host A character, GitLab host.
#' @param repos A character vector or repositories full names.
#' @return A \code{GitAI} object.
#' @export
set_gitlab_repos <- function(gitai,
host = NULL,
Expand Down
20 changes: 20 additions & 0 deletions man/add_files.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions man/initialize_project.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions man/process_repos.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions man/set_github_repos.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions man/set_gitlab_repos.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 15 additions & 3 deletions man/set_llm.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions man/set_prompt.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8909de8

Please sign in to comment.