diff --git a/.Rbuildignore b/.Rbuildignore
index fad2177..f0d6656 100644
--- a/.Rbuildignore
+++ b/.Rbuildignore
@@ -4,3 +4,11 @@
^\.Rproj\.user$
^LICENSE\.md$
^README\.Rmd$
+^devel
+^docs
+^pkgdown
+^project_metadata.yaml
+^\.github$
+^_pkgdown\.yml$
+^docs$
+^pkgdown$
diff --git a/.github/.gitignore b/.github/.gitignore
new file mode 100644
index 0000000..2d19fc7
--- /dev/null
+++ b/.github/.gitignore
@@ -0,0 +1 @@
+*.html
diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml
new file mode 100644
index 0000000..53b8fad
--- /dev/null
+++ b/.github/workflows/R-CMD-check.yaml
@@ -0,0 +1,48 @@
+# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
+# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
+on:
+ push:
+ branches: [main]
+ pull_request:
+ branches: [main]
+
+name: ๐ฎ R-CMD-check
+
+jobs:
+ R-CMD-check:
+ runs-on: ${{ matrix.config.os }}
+
+ name: ${{ matrix.config.os }} (${{ matrix.config.r }})
+
+ strategy:
+ fail-fast: false
+ matrix:
+ config:
+ - {os: macos-latest, r: 'release'}
+ - {os: windows-latest, r: 'release'}
+ - {os: ubuntu-latest, r: 'release'}
+
+ env:
+ GITHUB_PAT: ${{ secrets.TEST_GITHUB_PAT }}
+ R_KEEP_PKG_SOURCE: yes
+ USE_RENV: "FALSE"
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - uses: r-lib/actions/setup-pandoc@v2
+
+ - uses: r-lib/actions/setup-r@v2
+ with:
+ r-version: ${{ matrix.config.r }}
+ http-user-agent: ${{ matrix.config.http-user-agent }}
+ use-public-rspm: true
+
+ - name: Install R dependencies
+ run: |
+ Rscript -e 'install.packages(c("pak", "GitStats", "dplyr", "purrr", "testthat", "xml2", "rcmdcheck"))'
+ Rscript -e 'pak::pak("tidyverse/elmer")'
+
+ - uses: r-lib/actions/check-r-package@v2
+ with:
+ upload-snapshots: true
diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml
new file mode 100644
index 0000000..98fb928
--- /dev/null
+++ b/.github/workflows/lint.yaml
@@ -0,0 +1,29 @@
+name: ๐ต Lint
+
+on:
+ push:
+ branches: [main]
+ pull_request:
+ branches: [main]
+
+jobs:
+ lint:
+ runs-on: ubuntu-latest
+ env:
+ GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
+ steps:
+ - uses: actions/checkout@v4.1.4
+
+ - uses: r-lib/actions/setup-r@v2
+ with:
+ use-public-rspm: true
+
+ - name: Install R dependencies
+ run: install.packages("lintr")
+ shell: Rscript {0}
+
+ - name: Lint
+ run: lintr::lint_package()
+ shell: Rscript {0}
+ env:
+ LINTR_ERROR_ON_LINT: true
diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml
new file mode 100644
index 0000000..1992ed4
--- /dev/null
+++ b/.github/workflows/pkgdown.yaml
@@ -0,0 +1,50 @@
+# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
+# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
+on:
+ push:
+ branches: [main]
+ pull_request:
+ branches: [main]
+ release:
+ types: [published]
+ workflow_dispatch:
+
+name: ๐ Build site
+
+permissions: read-all
+
+jobs:
+ pkgdown:
+ runs-on: ubuntu-latest
+ # Only restrict concurrency for non-PR jobs
+ concurrency:
+ group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
+ env:
+ GITHUB_PAT: ${{ secrets.TEST_GITHUB_PAT }}
+ permissions:
+ contents: write
+ steps:
+ - uses: actions/checkout@v4
+
+ - uses: r-lib/actions/setup-pandoc@v2
+
+ - uses: r-lib/actions/setup-r@v2
+ with:
+ use-public-rspm: true
+
+ - name: Install R dependencies
+ run: |
+ Rscript -e 'install.packages(c("pkgdown", "remotes"))'
+ Rscript -e 'remotes::install_github("r-world-devs/GitAI")'
+
+ - name: Build site
+ run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
+ shell: Rscript {0}
+
+ - name: Deploy to GitHub pages ๐
+ if: github.event_name != 'pull_request'
+ uses: JamesIves/github-pages-deploy-action@v4.5.0
+ with:
+ clean: false
+ branch: gh-pages
+ folder: docs
diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml
new file mode 100644
index 0000000..92a40cc
--- /dev/null
+++ b/.github/workflows/test-coverage.yaml
@@ -0,0 +1,62 @@
+# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
+# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
+on:
+ push:
+ branches: [main]
+ pull_request:
+ branches: [main]
+
+name: ๐งช Test coverage
+
+permissions: read-all
+
+jobs:
+ test-coverage:
+ runs-on: ubuntu-latest
+ env:
+ GITHUB_PAT: ${{ secrets.TEST_GITHUB_PAT }}
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - uses: r-lib/actions/setup-r@v2
+ with:
+ use-public-rspm: true
+
+ - name: Install R dependencies
+ run: |
+ Rscript -e 'install.packages(c("pak", "GitStats", "dplyr", "purrr", "covr", "testthat", "xml2"))'
+ Rscript -e 'pak::pak("tidyverse/elmer")'
+
+ - name: Test coverage
+ run: |
+ cov <- covr::package_coverage(
+ quiet = FALSE,
+ clean = FALSE,
+ install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
+ )
+ covr::to_cobertura(cov)
+ shell: Rscript {0}
+
+ - uses: codecov/codecov-action@v4
+ with:
+ # Fail if error if not on PR, or if on PR and token is given
+ fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
+ file: ./cobertura.xml
+ plugin: noop
+ disable_search: true
+ token: ${{ secrets.CODECOV_TOKEN }}
+
+ - name: Show testthat output
+ if: always()
+ run: |
+ ## --------------------------------------------------------------------
+ find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
+ shell: bash
+
+ - name: Upload test results
+ if: failure()
+ uses: actions/upload-artifact@v4
+ with:
+ name: coverage-test-failures
+ path: ${{ runner.temp }}/package
diff --git a/.gitignore b/.gitignore
index 8b2e94c..4c14954 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
.Rproj.user
.Renviron
+docs
diff --git a/.lintr b/.lintr
new file mode 100644
index 0000000..37d7fa4
--- /dev/null
+++ b/.lintr
@@ -0,0 +1,11 @@
+linters: linters_with_defaults(
+ line_length_linter = line_length_linter(120L),
+ object_usage_linter = NULL,
+ object_length_linter = object_length_linter(45L),
+ object_name_linter = object_name_linter(
+ styles = c("snake_case", "CamelCase", "symbols"),
+ regexes = character()
+ ),
+ cyclocomp_linter = NULL
+ )
+encoding: "UTF-8"
diff --git a/DESCRIPTION b/DESCRIPTION
index 5c734c8..cf7bafd 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,6 +1,6 @@
Package: GitAI
Title: Extracts Knowledge From Git Repositories
-Version: 0.0.0.9004
+Version: 0.0.0.9005
Authors@R: c(
person("Kamil", "Wais", , "kamil.wais@gmail.com", role = c("aut", "cre")),
person("Maciej", "Banas", , "banasmaciek@gmail.com", role = "aut")
@@ -10,6 +10,14 @@ License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
+Imports:
+ cli (>= 3.4.0),
+ elmer,
+ GitStats,
+ httr2,
+ R6,
+ dplyr,
+ purrr
Suggests:
testthat (>= 3.0.0)
Config/testthat/edition: 3
diff --git a/GitAI.Rproj b/GitAI.Rproj
index aaa62a5..69fafd4 100644
--- a/GitAI.Rproj
+++ b/GitAI.Rproj
@@ -5,8 +5,13 @@ SaveWorkspace: No
AlwaysSaveHistory: Default
EnableCodeIndexing: Yes
+UseSpacesForTab: Yes
+NumSpacesForTab: 2
Encoding: UTF-8
+RnwWeave: Sweave
+LaTeX: pdfLaTeX
+
AutoAppendNewline: Yes
StripTrailingWhitespace: Yes
LineEndingConversion: Posix
diff --git a/NAMESPACE b/NAMESPACE
index 5573ed6..3b4de04 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -7,3 +7,5 @@ export(set_github_repos)
export(set_gitlab_repos)
export(set_llm)
export(set_prompt)
+importFrom(R6,R6Class)
+importFrom(httr2,with_verbosity)
diff --git a/R/GitAI-package.R b/R/GitAI-package.R
new file mode 100644
index 0000000..8b4a04c
--- /dev/null
+++ b/R/GitAI-package.R
@@ -0,0 +1,3 @@
+#' @importFrom R6 R6Class
+#' @importFrom httr2 with_verbosity
+NULL
diff --git a/R/GitAI.R b/R/GitAI.R
index c343d78..9fc08e7 100644
--- a/R/GitAI.R
+++ b/R/GitAI.R
@@ -23,8 +23,8 @@ GitAI <- R6::R6Class(
if (is.null(private$.llm))
stop(call. = FALSE, "LLM not set. Use set_llm() first.")
- if (missing(value)) return(private$.llm$system_prompt)
- private$.llm$system_prompt <- value
+ if (missing(value)) return(private$.llm$get_system_prompt())
+ private$.llm$set_system_prompt(value)
},
gitstats = function(value) {
diff --git a/R/add_files.R b/R/add_files.R
index 10928ab..d01293d 100644
--- a/R/add_files.R
+++ b/R/add_files.R
@@ -20,6 +20,6 @@ is_file_path_pattern <- function(string) {
all(!grepl("^\\*?\\.\\w{2,4}$", string))
}
-is_file_type_regex <- function(string){
+is_file_type_regex <- function(string) {
all(grepl("^\\*?\\.\\w{2,4}$|^.*\\*\\.\\w{2,4}$", string))
}
diff --git a/R/global.R b/R/global.R
new file mode 100644
index 0000000..d9a7f49
--- /dev/null
+++ b/R/global.R
@@ -0,0 +1 @@
+utils::globalVariables("file_content")
diff --git a/R/process_repos.R b/R/process_repos.R
index 26cbe7a..50208e6 100644
--- a/R/process_repos.R
+++ b/R/process_repos.R
@@ -32,7 +32,8 @@ process_repos <- function(gitai) {
process_content(gitai = gitai, content = content_to_process)
- }) |> purrr::set_names(files_content$repo_name)
+ }) |>
+ purrr::set_names(files_content$repo_name)
results
}
diff --git a/R/set_llm.R b/R/set_llm.R
index 21ddff5..4c81a97 100644
--- a/R/set_llm.R
+++ b/R/set_llm.R
@@ -4,6 +4,7 @@
#' @param provider A LLM provider.
#' @param model A LLM model.
#' @param seed An integer to make results more reproducible.
+#' @param ... Other arguments to pass to `elmer::chat_openai()` function.
#' @return A \code{GitAI} object.
#' @export
set_llm <- function(gitai,
@@ -27,7 +28,7 @@ set_llm <- function(gitai,
#' Set prompt.
#' @name set_prompt
-#' @param gitati A \code{GitAI} object.
+#' @param gitai A \code{GitAI} object.
#' @param system_prompt A system prompt.
#' @return A \code{GitAI} object.
#' @export
diff --git a/README.Rmd b/README.Rmd
index 784d63a..b1c40ac 100644
--- a/README.Rmd
+++ b/README.Rmd
@@ -16,6 +16,7 @@ knitr::opts_chunk$set(
# GitAI
+[](https://app.codecov.io/gh/r-world-devs/GitAI)
The goal of GitAI is to derive knowledge from GitHub or GitLab repositories with the use of AI/LLM (Large Language Models). With GitAI you can easily:
diff --git a/README.md b/README.md
index 24e143e..731d573 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,9 @@
# GitAI
+
+[](https://app.codecov.io/gh/r-world-devs/GitAI)
The goal of GitAI is to derive knowledge from GitHub or GitLab
diff --git a/_pkgdown.yml b/_pkgdown.yml
new file mode 100644
index 0000000..130e54d
--- /dev/null
+++ b/_pkgdown.yml
@@ -0,0 +1,5 @@
+title: GitAI
+url: https://r-world-devs.github.io/GitAI/
+template:
+ bootstrap: 5
+
diff --git a/man/set_llm.Rd b/man/set_llm.Rd
index 7a1597e..66e20b0 100644
--- a/man/set_llm.Rd
+++ b/man/set_llm.Rd
@@ -14,6 +14,8 @@ set_llm(gitai, provider = "openai", model = "gpt-4o-mini", seed = NULL, ...)
\item{model}{A LLM model.}
\item{seed}{An integer to make results more reproducible.}
+
+\item{...}{Other arguments to pass to \code{elmer::chat_openai()} function.}
}
\value{
A \code{GitAI} object.
diff --git a/man/set_prompt.Rd b/man/set_prompt.Rd
index 95dc4db..9b3eb43 100644
--- a/man/set_prompt.Rd
+++ b/man/set_prompt.Rd
@@ -7,9 +7,9 @@
set_prompt(gitai, system_prompt)
}
\arguments{
-\item{system_prompt}{A system prompt.}
+\item{gitai}{A \code{GitAI} object.}
-\item{gitati}{A \code{GitAI} object.}
+\item{system_prompt}{A system prompt.}
}
\value{
A \code{GitAI} object.
diff --git a/renv.lock b/renv.lock
index 1aafed2..cbb4ea8 100644
--- a/renv.lock
+++ b/renv.lock
@@ -9,6 +9,25 @@
]
},
"Packages": {
+ "GitStats": {
+ "Package": "GitStats",
+ "Version": "2.1.2",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "R6",
+ "cli",
+ "dplyr",
+ "glue",
+ "httr2",
+ "lubridate",
+ "magrittr",
+ "purrr",
+ "rlang",
+ "stringr"
+ ],
+ "Hash": "7c9669f1a8fab1f53575323f9aa23d29"
+ },
"R6": {
"Package": "R6",
"Version": "2.5.1",
@@ -21,14 +40,14 @@
},
"S7": {
"Package": "S7",
- "Version": "0.1.1",
+ "Version": "0.2.0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"utils"
],
- "Hash": "7373b41e159901733e4e167d15394163"
+ "Hash": "5deb66b3ae702137e1f4162c11861e76"
},
"askpass": {
"Package": "askpass",
@@ -40,6 +59,16 @@
],
"Hash": "c39f4155b3ceb1a9a2799d700fbd4b6a"
},
+ "base64enc": {
+ "Package": "base64enc",
+ "Version": "0.1-3",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "R"
+ ],
+ "Hash": "543776ae6848fde2f48ff3816d0628bc"
+ },
"brio": {
"Package": "brio",
"Version": "1.1.5",
@@ -50,6 +79,39 @@
],
"Hash": "c1ee497a6d999947c2c224ae46799b1a"
},
+ "bslib": {
+ "Package": "bslib",
+ "Version": "0.8.0",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "R",
+ "base64enc",
+ "cachem",
+ "fastmap",
+ "grDevices",
+ "htmltools",
+ "jquerylib",
+ "jsonlite",
+ "lifecycle",
+ "memoise",
+ "mime",
+ "rlang",
+ "sass"
+ ],
+ "Hash": "b299c6741ca9746fb227debcb0f9fb6c"
+ },
+ "cachem": {
+ "Package": "cachem",
+ "Version": "1.1.0",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "fastmap",
+ "rlang"
+ ],
+ "Hash": "cd9a672193789068eb5a2aad65a0dedf"
+ },
"callr": {
"Package": "callr",
"Version": "3.7.6",
@@ -76,14 +138,24 @@
},
"coro": {
"Package": "coro",
- "Version": "1.0.5",
+ "Version": "1.1.0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"rlang"
],
- "Hash": "63211e5e909f85146985272579ef31e1"
+ "Hash": "4998c8836ff95c90993a4eb8d853df71"
+ },
+ "cpp11": {
+ "Package": "cpp11",
+ "Version": "0.5.0",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "R"
+ ],
+ "Hash": "91570bba75d0c9d3f1040c835cee8fba"
},
"crayon": {
"Package": "crayon",
@@ -99,13 +171,13 @@
},
"curl": {
"Package": "curl",
- "Version": "6.0.0",
+ "Version": "6.0.1",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R"
],
- "Hash": "ff51697d9205fe715f29e7171e874c6e"
+ "Hash": "e8ba62486230951fcd2b881c5be23f96"
},
"desc": {
"Package": "desc",
@@ -146,6 +218,29 @@
],
"Hash": "33698c4b3127fc9f506654607fb73676"
},
+ "dplyr": {
+ "Package": "dplyr",
+ "Version": "1.1.4",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "R",
+ "R6",
+ "cli",
+ "generics",
+ "glue",
+ "lifecycle",
+ "magrittr",
+ "methods",
+ "pillar",
+ "rlang",
+ "tibble",
+ "tidyselect",
+ "utils",
+ "vctrs"
+ ],
+ "Hash": "fedd9d00c2944ff00a0e2696ccf048ec"
+ },
"elmer": {
"Package": "elmer",
"Version": "0.0.0.9000",
@@ -155,7 +250,7 @@
"RemoteRepo": "elmer",
"RemoteUsername": "tidyverse",
"RemotePkgRef": "tidyverse/elmer",
- "RemoteSha": "a7b55f39890a544d0d2897ca3a357b6dbfa4e70b",
+ "RemoteSha": "848fd2f0739a73863c86246a3e1f8fd95b73d4ef",
"Requirements": [
"R6",
"S7",
@@ -166,7 +261,7 @@
"jsonlite",
"rlang"
],
- "Hash": "3705380a1215542184ea8e5ec4398f3b"
+ "Hash": "7b6008b2091a6d4a93b8e57bef424449"
},
"evaluate": {
"Package": "evaluate",
@@ -178,6 +273,37 @@
],
"Hash": "3fd29944b231036ad67c3edb32e02201"
},
+ "fansi": {
+ "Package": "fansi",
+ "Version": "1.0.6",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "R",
+ "grDevices",
+ "utils"
+ ],
+ "Hash": "962174cf2aeb5b9eea581522286a911f"
+ },
+ "fastmap": {
+ "Package": "fastmap",
+ "Version": "1.2.0",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Hash": "aa5e1cd11c2d15497494c5292d7ffcc8"
+ },
+ "fontawesome": {
+ "Package": "fontawesome",
+ "Version": "0.5.3",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "R",
+ "htmltools",
+ "rlang"
+ ],
+ "Hash": "bd1297f9b5b1fc1372d19e2c4cd82215"
+ },
"fs": {
"Package": "fs",
"Version": "1.6.5",
@@ -189,6 +315,17 @@
],
"Hash": "7f48af39fa27711ea5fbd183b399920d"
},
+ "generics": {
+ "Package": "generics",
+ "Version": "0.1.3",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "R",
+ "methods"
+ ],
+ "Hash": "15e9634c0fcd294799e9b2e929ed1b86"
+ },
"glue": {
"Package": "glue",
"Version": "1.8.0",
@@ -200,6 +337,33 @@
],
"Hash": "5899f1eaa825580172bb56c08266f37c"
},
+ "highr": {
+ "Package": "highr",
+ "Version": "0.11",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "R",
+ "xfun"
+ ],
+ "Hash": "d65ba49117ca223614f71b60d85b8ab7"
+ },
+ "htmltools": {
+ "Package": "htmltools",
+ "Version": "0.5.8.1",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "R",
+ "base64enc",
+ "digest",
+ "fastmap",
+ "grDevices",
+ "rlang",
+ "utils"
+ ],
+ "Hash": "81d371a9cc60640e74e4ab6ac46dcedc"
+ },
"httr2": {
"Package": "httr2",
"Version": "1.0.6.9000",
@@ -209,7 +373,7 @@
"RemoteRepo": "httr2",
"RemoteUsername": "r-lib",
"RemotePkgRef": "r-lib/httr2",
- "RemoteSha": "bb948b318762ea0c8615954bd0543cb1e11ba791",
+ "RemoteSha": "651665d811e8f88d55c472dae50f3116aaf3da32",
"Requirements": [
"R",
"R6",
@@ -224,7 +388,17 @@
"vctrs",
"withr"
],
- "Hash": "15a8e4ac390329125e7a961e75d65582"
+ "Hash": "07091206ec270c43fa3913e40536d5ac"
+ },
+ "jquerylib": {
+ "Package": "jquerylib",
+ "Version": "0.1.4",
+ "Source": "Repository",
+ "Repository": "RSPM",
+ "Requirements": [
+ "htmltools"
+ ],
+ "Hash": "5aab57a3bd297eee1c1d862735972182"
},
"jsonlite": {
"Package": "jsonlite",
@@ -236,6 +410,22 @@
],
"Hash": "4e993b65c2c3ffbffce7bb3e2c6f832b"
},
+ "knitr": {
+ "Package": "knitr",
+ "Version": "1.49",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "R",
+ "evaluate",
+ "highr",
+ "methods",
+ "tools",
+ "xfun",
+ "yaml"
+ ],
+ "Hash": "9fcb189926d93c636dea94fbe4f44480"
+ },
"lifecycle": {
"Package": "lifecycle",
"Version": "1.0.4",
@@ -249,6 +439,19 @@
],
"Hash": "b8552d117e1b808b09a832f589b79035"
},
+ "lubridate": {
+ "Package": "lubridate",
+ "Version": "1.9.3",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "R",
+ "generics",
+ "methods",
+ "timechange"
+ ],
+ "Hash": "680ad542fbcf801442c83a6ac5a2126c"
+ },
"magrittr": {
"Package": "magrittr",
"Version": "2.0.3",
@@ -259,6 +462,27 @@
],
"Hash": "7ce2733a9826b3aeb1775d56fd305472"
},
+ "memoise": {
+ "Package": "memoise",
+ "Version": "2.0.1",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "cachem",
+ "rlang"
+ ],
+ "Hash": "e2817ccf4a065c5d9d7f2cfbe7c1d78c"
+ },
+ "mime": {
+ "Package": "mime",
+ "Version": "0.12",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "tools"
+ ],
+ "Hash": "18e9c28c1d3ca1560ce30658b22ce104"
+ },
"openssl": {
"Package": "openssl",
"Version": "2.2.2",
@@ -281,6 +505,23 @@
],
"Hash": "019d4d5634410800a96b69737fb2dbac"
},
+ "pillar": {
+ "Package": "pillar",
+ "Version": "1.9.0",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "cli",
+ "fansi",
+ "glue",
+ "lifecycle",
+ "rlang",
+ "utf8",
+ "utils",
+ "vctrs"
+ ],
+ "Hash": "15da5a8412f317beeee6175fbc76f4bb"
+ },
"pkgbuild": {
"Package": "pkgbuild",
"Version": "1.4.5",
@@ -296,6 +537,16 @@
],
"Hash": "30eaaab94db72652e72e3475c1b55278"
},
+ "pkgconfig": {
+ "Package": "pkgconfig",
+ "Version": "2.0.3",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "utils"
+ ],
+ "Hash": "01f28d4278f15c76cddbea05899c5d6f"
+ },
"pkgload": {
"Package": "pkgload",
"Version": "1.4.0",
@@ -349,6 +600,21 @@
],
"Hash": "b4404b1de13758dea1c0484ad0d48563"
},
+ "purrr": {
+ "Package": "purrr",
+ "Version": "1.0.2",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "R",
+ "cli",
+ "lifecycle",
+ "magrittr",
+ "rlang",
+ "vctrs"
+ ],
+ "Hash": "1cba04a4e9414bdefc9dcaa99649a8dc"
+ },
"rappdirs": {
"Package": "rappdirs",
"Version": "0.3.3",
@@ -380,6 +646,29 @@
],
"Hash": "3eec01f8b1dee337674b2e34ab1f9bc1"
},
+ "rmarkdown": {
+ "Package": "rmarkdown",
+ "Version": "2.29",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "R",
+ "bslib",
+ "evaluate",
+ "fontawesome",
+ "htmltools",
+ "jquerylib",
+ "jsonlite",
+ "knitr",
+ "methods",
+ "tinytex",
+ "tools",
+ "utils",
+ "xfun",
+ "yaml"
+ ],
+ "Hash": "df99277f63d01c34e95e3d2f06a79736"
+ },
"rprojroot": {
"Package": "rprojroot",
"Version": "2.0.4",
@@ -390,6 +679,50 @@
],
"Hash": "4c8415e0ec1e29f3f4f6fc108bef0144"
},
+ "sass": {
+ "Package": "sass",
+ "Version": "0.4.9",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "R6",
+ "fs",
+ "htmltools",
+ "rappdirs",
+ "rlang"
+ ],
+ "Hash": "d53dbfddf695303ea4ad66f86e99b95d"
+ },
+ "stringi": {
+ "Package": "stringi",
+ "Version": "1.8.4",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "R",
+ "stats",
+ "tools",
+ "utils"
+ ],
+ "Hash": "39e1144fd75428983dc3f63aa53dfa91"
+ },
+ "stringr": {
+ "Package": "stringr",
+ "Version": "1.5.1",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "R",
+ "cli",
+ "glue",
+ "lifecycle",
+ "magrittr",
+ "rlang",
+ "stringi",
+ "vctrs"
+ ],
+ "Hash": "960e2ae9e09656611e0b8214ad543207"
+ },
"sys": {
"Package": "sys",
"Version": "3.4.3",
@@ -426,6 +759,72 @@
],
"Hash": "3f6e7e5e2220856ff865e4834766bf2b"
},
+ "tibble": {
+ "Package": "tibble",
+ "Version": "3.2.1",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "R",
+ "fansi",
+ "lifecycle",
+ "magrittr",
+ "methods",
+ "pillar",
+ "pkgconfig",
+ "rlang",
+ "utils",
+ "vctrs"
+ ],
+ "Hash": "a84e2cc86d07289b3b6f5069df7a004c"
+ },
+ "tidyselect": {
+ "Package": "tidyselect",
+ "Version": "1.2.1",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "R",
+ "cli",
+ "glue",
+ "lifecycle",
+ "rlang",
+ "vctrs",
+ "withr"
+ ],
+ "Hash": "829f27b9c4919c16b593794a6344d6c0"
+ },
+ "timechange": {
+ "Package": "timechange",
+ "Version": "0.3.0",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "R",
+ "cpp11"
+ ],
+ "Hash": "c5f3c201b931cd6474d17d8700ccb1c8"
+ },
+ "tinytex": {
+ "Package": "tinytex",
+ "Version": "0.54",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "xfun"
+ ],
+ "Hash": "3ec7e3ddcacc2d34a9046941222bf94d"
+ },
+ "utf8": {
+ "Package": "utf8",
+ "Version": "1.2.4",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "R"
+ ],
+ "Hash": "62b65c52671e6665f803ff02954446e9"
+ },
"vctrs": {
"Package": "vctrs",
"Version": "0.6.5",
@@ -442,7 +841,7 @@
},
"waldo": {
"Package": "waldo",
- "Version": "0.6.0",
+ "Version": "0.6.1",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
@@ -453,7 +852,7 @@
"methods",
"rlang"
],
- "Hash": "53ec6571dc7a321797cde0abe007ff53"
+ "Hash": "52f574062a7b66e56926988c3fbdb3b7"
},
"withr": {
"Package": "withr",
@@ -466,6 +865,26 @@
"graphics"
],
"Hash": "cc2d62c76458d425210d1eb1478b30b4"
+ },
+ "xfun": {
+ "Package": "xfun",
+ "Version": "0.49",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Requirements": [
+ "R",
+ "grDevices",
+ "stats",
+ "tools"
+ ],
+ "Hash": "8687398773806cfff9401a2feca96298"
+ },
+ "yaml": {
+ "Package": "yaml",
+ "Version": "2.3.10",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Hash": "51dab85c6c98e50a18d7551e9d49f76c"
}
}
}
diff --git a/tests/testthat/test-add_files.R b/tests/testthat/test-add_files.R
index 9ab2ba3..e0fbd12 100644
--- a/tests/testthat/test-add_files.R
+++ b/tests/testthat/test-add_files.R
@@ -14,8 +14,8 @@ test_that("add_files adds file_types to GitAI settings", {
my_project <- initialize_project("gitai_test_project")
my_project <-
my_project |>
- add_files(files = "*.md")
- expect_equal("*.md", my_project$files)
+ add_files(files = "*.md")
+ expect_equal("*.md", my_project$files)
})
test_that("add_files returns error when other than character type is passed", {
diff --git a/tests/testthat/test-initialize_project.R b/tests/testthat/test-initialize_project.R
index 7f8444a..4931207 100644
--- a/tests/testthat/test-initialize_project.R
+++ b/tests/testthat/test-initialize_project.R
@@ -1,17 +1,16 @@
test_that("project can be initialized", {
-
+
expect_error(initialize_project())
test_project_id <- "gitai_test_project"
my_project <- initialize_project(project_id = test_project_id)
- expect_true("R6" %in% class(my_project))
- expect_true("GitAI" %in% class(my_project))
+ expect_true("R6" %in% class(my_project))
+ expect_true("GitAI" %in% class(my_project))
- expect_equal(my_project$project_id,
+ expect_equal(my_project$project_id,
test_project_id)
expect_null(my_project$llm)
})
-
diff --git a/tests/testthat/test-process_content.R b/tests/testthat/test-process_content.R
index 21eb2b6..970a03b 100644
--- a/tests/testthat/test-process_content.R
+++ b/tests/testthat/test-process_content.R
@@ -1,15 +1,15 @@
test_that("processing content have proper output structure", {
-
- my_project <-
- initialize_project("gitai_test_project") |>
- set_llm() |>
+
+ my_project <-
+ initialize_project("gitai_test_project") |>
+ set_llm() |>
set_prompt(system_prompt = "Say 'Hi there!' only and nothing else.")
result <- process_content(gitai = my_project, content = "")
-
+
expect_equal(result$text,
"Hi there!")
-
+
result$tokens |> is.numeric() |> expect_true()
result$output |> is.list() |> expect_true()
result$content_nchars |> is.numeric() |> expect_true()
@@ -17,21 +17,27 @@ test_that("processing content have proper output structure", {
})
test_that("processing a single file content with deterministic output", {
-
- my_project <-
- initialize_project("gitai_test_project") |>
- set_llm(seed = 1014, api_args = list(temperature = 0)) |>
+
+ my_project <-
+ initialize_project("gitai_test_project") |>
+ set_llm(seed = 1014, api_args = list(temperature = 0)) |>
set_prompt(system_prompt = "Summarize provided conent with one, short sentence.")
- test_content <- "Artificial intelligence (AI) plays a crucial role in transforming industries by automating repetitive tasks and enhancing productivity. It enables personalized experiences in sectors like healthcare, finance, and entertainment by analyzing vast amounts of data. AI algorithms assist in decision-making processes by providing insights that humans may overlook. In addition, AI is vital for advancements in technologies such as self-driving cars and smart home devices. Overall, AI acts as a powerful tool for innovation, driving efficiencies, and solving complex problems."
+ test_content <- paste0(
+ "Artificial intelligence (AI) plays a crucial role in transforming industries",
+ "by automating repetitive tasks and enhancing productivity. It enables personalized experiences",
+ "in sectors like healthcare, finance, and entertainment by analyzing vast amounts of data. AI algorithms",
+ "assist in decision-making processes by providing insights that humans may overlook. In addition,",
+ "AI is vital for advancements in technologies such as self-driving cars and smart home devices. Overall,",
+ "AI acts as a powerful tool for innovation, driving efficiencies, and solving complex problems."
+ )
httr2::with_verbosity(verbosity = 0, {
-
- result <- process_content(gitai = my_project,
- content = test_content)
+ result <- process_content(gitai = my_project,
+ content = test_content)
})
expect_length(gregexpr("\\.", result$text)[[1]], 1)
-
+
expect_equal(result$text,
process_content(gitai = my_project, content = test_content)$text)
diff --git a/tests/testthat/test-set_llm.R b/tests/testthat/test-set_llm.R
index 681e40f..d832a54 100644
--- a/tests/testthat/test-set_llm.R
+++ b/tests/testthat/test-set_llm.R
@@ -2,8 +2,8 @@ test_that("setting LLM ", {
my_project <- initialize_project("gitai_test_project")
- my_project <-
- my_project |>
+ my_project <-
+ my_project |>
set_llm()
expect_true("Chat" %in% class(my_project$llm))
@@ -15,18 +15,19 @@ test_that("setting system prompt", {
my_project <- initialize_project("gitai_test_project")
expect_error(
- my_project |>
- set_prompt(system_prompt = "You always return only 'Hi there!'")
+ my_project |>
+ set_prompt(system_prompt = "You always return only 'Hi there!'")
)
- my_project <-
- my_project |>
- set_llm() |>
+ my_project <-
+ my_project |>
+ set_llm() |>
set_prompt(system_prompt = "You always return only 'Hi there!'")
expect_equal(
- my_project$llm$system_prompt, "You always return only 'Hi there!'")
-
+ my_project$llm$get_system_prompt(), "You always return only 'Hi there!'"
+ )
+
expect_equal(
my_project$llm$chat("Hi"),
"Hi there!"