diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index f92b560..c28a778 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -19,7 +19,7 @@ jobs: matrix: config: - {os: macos-latest, r: 'release'} - #- {os: windows-latest, r: 'release'} + - {os: windows-latest, r: 'release'} - {os: ubuntu-latest, r: 'release'} env: @@ -28,7 +28,7 @@ jobs: R_KEEP_PKG_SOURCE: yes steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: r-lib/actions/setup-pandoc@v2 @@ -38,12 +38,12 @@ jobs: http-user-agent: ${{ matrix.config.http-user-agent }} use-public-rspm: true - - uses: r-lib/actions/setup-renv@v2 - - - name: Install extra R dependencies - run: | - Rscript -e 'renv::install("rcmdcheck")' + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck + needs: check - uses: r-lib/actions/check-r-package@v2 with: upload-snapshots: true + build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index dfbfcf5..486e68a 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -20,11 +20,28 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: r-lib/actions/setup-r@v2 + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y software-properties-common + sudo add-apt-repository universe + sudo apt-get update && sudo apt-get install -y \ + libfontconfig1-dev \ + libfreetype6-dev \ + libpng-dev \ + libtiff5-dev \ + libjpeg-dev \ + libharfbuzz-dev \ + libfribidi-dev \ + pkg-config + + - name: Set up R + uses: r-lib/actions/setup-r@v2 with: use-public-rspm: true - - uses: r-lib/actions/setup-renv@v2 + - name: Restore R dependencies with renv + uses: r-lib/actions/setup-renv@v2 - name: Install extra R dependencies run: | diff --git a/DESCRIPTION b/DESCRIPTION index 645a490..f3ce54a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: GitAI Title: Extracts Knowledge from 'Git' Repositories -Version: 0.1.0 +Version: 0.1.1 Authors@R: c( person("Kamil", "Wais", , "kamil.wais@gmail.com", role = c("aut", "cre")), person("Krystian", "Igras", , "krystian8207@gmail.com", role = "aut"), diff --git a/NEWS.md b/NEWS.md new file mode 100644 index 0000000..5e80ca6 --- /dev/null +++ b/NEWS.md @@ -0,0 +1,4 @@ +# GitAI 0.1.1 + +* Fixed tests to make them work with `ellmer` 0.2.0. +* Added a `NEWS.md` file to track changes to the package. diff --git a/R/set_llm.R b/R/set_llm.R index 9816372..a8f77da 100644 --- a/R/set_llm.R +++ b/R/set_llm.R @@ -25,8 +25,8 @@ set_llm <- function(gitai, provider = "openai", ...) { } llm_default_args <- list( - openai = list(model = "gpt-4o-mini", seed = NULL, echo = "none"), - ollama = list(model = "llama3.2", seed = NULL), + openai = list(model = "gpt-4o-mini", params = NULL, echo = "none"), + ollama = list(model = "llama3.2", params = NULL), bedrock = list(model = "anthropic.claude-3-5-sonnet-20240620-v1:0") ) diff --git a/README.Rmd b/README.Rmd index 94b3d9e..f05c642 100644 --- a/README.Rmd +++ b/README.Rmd @@ -17,6 +17,7 @@ knitr::opts_chunk$set( [![Codecov test coverage](https://codecov.io/gh/r-world-devs/GitAI/graph/badge.svg)](https://app.codecov.io/gh/r-world-devs/GitAI) +[![R-CMD-check](https://github.com/r-world-devs/GitAI/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-world-devs/GitAI/actions/workflows/R-CMD-check.yaml) > The goal of `GitAI` is to **extract knowledge from Git repositories** with the use of AI/LLM (Large Language Models). @@ -108,4 +109,4 @@ purrr::walk(results, function(result) { Our `GitAI` uses under the hood the `GitStats` R package. If you want to use it directly for pulling git data, check out: -[https://r-world-devs.github.io/GitStats/](https://r-world-devs.github.io/GitStats/) \ No newline at end of file +[https://r-world-devs.github.io/GitStats/](https://r-world-devs.github.io/GitStats/) diff --git a/README.md b/README.md index 539be4e..cef00db 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ [![Codecov test coverage](https://codecov.io/gh/r-world-devs/GitAI/graph/badge.svg)](https://app.codecov.io/gh/r-world-devs/GitAI) +[![R-CMD-check](https://github.com/r-world-devs/GitAI/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-world-devs/GitAI/actions/workflows/R-CMD-check.yaml) > The goal of `GitAI` is to **extract knowledge from Git repositories** @@ -89,6 +90,13 @@ my_project <- initialize_project("fascinating_project") |> add_files(files = "README.md") |> set_llm() |> set_prompt("Write one-sentence summary for a project based on given input.") +#> Warning: The `seed` argument of `chat_openai()` is deprecated as of ellmer 0.2.0. +#> ℹ Please use the `params` argument instead. +#> ℹ The deprecated feature was likely used in the GitAI package. +#> Please report the issue to the authors. +#> This warning is displayed once every 8 hours. +#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was +#> generated. ``` Now, let’s get the results and print them. @@ -99,18 +107,19 @@ results <- process_repos(my_project) purrr::walk(results, function(result) { result$text |> stringr::str_wrap(width = 80) |> cat("\n\n") }) -#> GitStats is an experimental R package that facilitates the extraction -#> and analysis of git data from GitHub and GitLab, providing insights into -#> repositories, commits, users, and R package usage in a structured format. +#> GitStats is an R package that allows users to uniformly extract and analyze +#> git data from GitHub and GitLab, including repositories, commits, issues, and +#> R package usage, enabling the generation of basic statistics and insights into +#> version control activities. #> -#> GitAI is an R package that leverages AI and Large Language Models to extract -#> insights from GitHub or GitLab repositories, allowing users to define project -#> scopes, select relevant content, and process repositories efficiently in a -#> tidyverse-compliant manner. +#> `GitAI` is an R-based framework designed to harness AI and Large Language +#> Models for extracting and summarizing knowledge from multiple Git repositories +#> efficiently, addressing the challenges of manual review and knowledge +#> reusability in large organizations. #> -#> DataFakeR is an R package that enables users to generate synthetic datasets -#> while maintaining specified assumptions about the original data structure, -#> facilitating data simulation for testing and analysis. +#> DataFakeR is an R package that enables users to generate realistic fake datasets +#> while preserving specific attributes and dependencies based on a configurable +#> schema, facilitating data simulation for testing and validation purposes. ``` ## See also diff --git a/man/GitAI-package.Rd b/man/GitAI-package.Rd index 9d761cc..85ba8bd 100644 --- a/man/GitAI-package.Rd +++ b/man/GitAI-package.Rd @@ -8,7 +8,7 @@ \description{ \if{html}{\figure{logo.png}{options: style='float: right' alt='logo' width='120'}} -Scan multiple Git repositories, pull specified files content and process it with Large Language Models. You can summarize the content in specific way, extract information and data, or find answers to your questions about the repositories. The output can be stored in vector database and used for semantic search or as a part of a RAG (Retrieval Augmented Generation) prompt. +Scan multiple 'Git' repositories, pull specified files content and process it with large language models. You can summarize the content in specific way, extract information and data, or find answers to your questions about the repositories. The output can be stored in vector database and used for semantic search or as a part of a RAG (Retrieval Augmented Generation) prompt. } \author{ \strong{Maintainer}: Kamil Wais \email{kamil.wais@gmail.com} diff --git a/renv.lock b/renv.lock index 1709a38..b127fd7 100644 --- a/renv.lock +++ b/renv.lock @@ -1,6 +1,6 @@ { "R": { - "Version": "4.4.1", + "Version": "4.4.3", "Repositories": [ { "Name": "CRAN", @@ -42,13 +42,13 @@ }, "R6": { "Package": "R6", - "Version": "2.6.0", + "Version": "2.6.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R" ], - "Hash": "245934b1f739076a00b61ee7d9cd5233" + "Hash": "d4335fe7207f1c01ab8c41762f5840d4" }, "Rcpp": { "Package": "Rcpp", @@ -150,14 +150,14 @@ }, "cli": { "Package": "cli", - "Version": "3.6.1", + "Version": "3.6.5", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "utils" ], - "Hash": "89e6d8219950eac806ae0c489052048a" + "Hash": "16850760556401a2eeb27d39bd11c9cb" }, "commonmark": { "Package": "commonmark", @@ -201,13 +201,13 @@ }, "curl": { "Package": "curl", - "Version": "6.2.0", + "Version": "6.2.2", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R" ], - "Hash": "b580cbb010099fd990df6bfe44459e1a" + "Hash": "e4f9e10b18f453a1b7eaf38247dad4fe" }, "desc": { "Package": "desc", @@ -293,10 +293,11 @@ }, "ellmer": { "Package": "ellmer", - "Version": "0.1.1", + "Version": "0.2.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ + "R", "R6", "S7", "cli", @@ -309,7 +310,7 @@ "promises", "rlang" ], - "Hash": "754d3a8cbb25b05be2058892f579422f" + "Hash": "08f7504cda76185e0f689b19357706e0" }, "evaluate": { "Package": "evaluate", @@ -429,7 +430,7 @@ }, "httr2": { "Package": "httr2", - "Version": "1.1.0", + "Version": "1.1.2", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -446,7 +447,7 @@ "vctrs", "withr" ], - "Hash": "0f14199bbd820a9fca398f2df40994f1" + "Hash": "ade531519694081d91036b509eb30594" }, "jquerylib": { "Package": "jquerylib", @@ -775,14 +776,14 @@ }, "rlang": { "Package": "rlang", - "Version": "1.1.5", + "Version": "1.1.6", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "utils" ], - "Hash": "724dcc1490cd7071ee75ca2994a5446e" + "Hash": "892124978869b74935dc3934c42bfe5a" }, "rmarkdown": { "Package": "rmarkdown", @@ -921,7 +922,7 @@ }, "stringi": { "Package": "stringi", - "Version": "1.8.4", + "Version": "1.8.7", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -930,7 +931,7 @@ "tools", "utils" ], - "Hash": "39e1144fd75428983dc3f63aa53dfa91" + "Hash": "2b56088e23bdd58f89aebf43a0913457" }, "stringr": { "Package": "stringr", diff --git a/tests/testthat/setup.R b/tests/testthat/setup.R index 4df03b3..6dd373b 100644 --- a/tests/testthat/setup.R +++ b/tests/testthat/setup.R @@ -21,9 +21,11 @@ mock_chat_method <- function(turns = NULL, provider_class) { provider_args <- rlang::dots_list(...) - provider <- rlang::exec(provider_class, !!!provider_args) + provider <- rlang::exec(provider_class, name = "mock", !!!provider_args) - ChatMocked$new(provider = provider, turns = turns, echo = echo) + chat <- ChatMocked$new(provider = provider, echo = echo) + chat$set_turns(turns) + chat } chat_openai_mocked <- function(system_prompt = NULL, @@ -32,6 +34,7 @@ chat_openai_mocked <- function(system_prompt = NULL, api_key = "mocked_key", model = NULL, seed = NULL, + params = NULL, api_args = list(), echo = c("none", "text", "all")) { @@ -39,8 +42,9 @@ chat_openai_mocked <- function(system_prompt = NULL, model <- ellmer:::set_default(model, "gpt-4o") echo <- ellmer:::check_echo(echo) + params <- params %||% ellmer::params() if (is.null(seed)) { - seed <- 1014 + params$seed <- 1014 } mock_chat_method( @@ -48,7 +52,7 @@ chat_openai_mocked <- function(system_prompt = NULL, echo = echo, base_url = base_url, model = model, - seed = seed, + params = params, extra_args = api_args, api_key = api_key, provider_class = ellmer:::ProviderOpenAI diff --git a/tests/testthat/test-process_content.R b/tests/testthat/test-process_content.R index 9c34af0..4e1dcf7 100644 --- a/tests/testthat/test-process_content.R +++ b/tests/testthat/test-process_content.R @@ -13,11 +13,13 @@ test_that("processing content have proper output structure", { }) test_that("processing a single file content with deterministic output", { - + skip_on_cran() + skip_if_not(interactive()) + params <- ellmer::params(seed = 1014) my_project <- initialize_project("gitai_test_project") |> - set_llm(seed = 1014, api_args = list(temperature = 0)) |> + set_llm(params = params, api_args = list(temperature = 0)) |> set_prompt(system_prompt = "Summarize provided conent with one, short sentence.") - + test_content <- r"( Artificial intelligence (AI) plays a crucial role in transforming industries by automating repetitive tasks and enhancing productivity. It enables personalized experiences