Skip to content

foundryR

1.0.0Package record

Data Frame Workflows for 'Microsoft Foundry'

0packages depend
563downloads / year
81.3%test coverage
13/13flavors OK

Overview

About

Work with 'Microsoft Foundry' from data-frame-oriented 'R' workflows. Provides data-frame-returning helpers for 'Azure AI Content Safety', 'Azure OpenAI' Responses API calls, strict structured extraction, vector representations, files, batch jobs, audio, media, and chat completions. Supports research annotation, safety gates, semantic search, and 'tidymodels' recipes. Helps teams keep model workflows inside their 'Azure' environment while preserving analyzable outputs. See the Microsoft Foundry REST API documentation https://learn.microsoft.com/rest/api/microsoft-foundry/ and Azure AI Content Safety documentation https://learn.microsoft.com/azure/ai-services/content-safety/.

Changes in 1.0.0

foundryR's lifecycle stage is now stable instead of experimental. After this release, breaking changes to exported functions will go through a deprecation cycle. Functions marked experimental in their documentation, and operations that use preview APIs, can still change without one; see vignette("api-support").

Breaking changes

These changes can alter the output of code written for 0.1.0. Most fix behavior that was wrong or that the service rejected.

  • foundry_transcribe() now uses standard Speech fast transcription by default, with no enhanced mode and no model. The old default, enhanced mode with mai-transcribe-1.5, is rejected in many regions, including East US 2. Pass model = "mai-transcribe-2" or the new enhanced = TRUE to use MAI-Transcribe or LLM Speech where they are available.
  • foundry_translate_audio() no longer defaults to a MAI-Transcribe model for Speech translation, because MAI-Transcribe does not translate. Speech translation still needs LLM Speech enhanced mode.
  • OpenAI-route audio calls (foundry_transcribe() and foundry_translate_audio() with service = "openai", and foundry_speak()) now require an explicit model deployment name instead of falling back to AZURE_FOUNDRY_MODEL, which usually names a chat deployment.
  • foundry_file_upload() no longer sends a 30-day expiry by default (expires_after_seconds = NULL). The service rejects an expiry for purpose = "assistants", which is the default purpose, so default uploads failed. Pass expires_after_seconds to set an expiry on batch files.
  • foundry_moderate() now labels severities on Microsoft's scale: 0-1 safe, 2-3 low, 4-5 medium, 6-7 high. The old labels were wrong on the eight-level scale; severity 1, for example, was labeled "low".
  • foundry_moderate() and foundry_shield() keep the full input text instead of truncating it, and gain an .input_idx column for joining results back to your data. foundry_shield() names documents by their original position, so skipping an empty document no longer renumbers the rest. foundry_moderate() gains a blocklist_hit column.
  • foundry_moderate(), foundry_shield(), and foundry_groundedness() return NA when the service omits a safety field, instead of reporting the input as safe or clean.
  • foundry_extract() returns your columns first, then the extracted fields, then the dot-prefixed metadata. Field types now follow the schema: a JSON null becomes a typed NA, and array and object fields are always list-columns. It stops before sending any request when a schema field has the same name as one of your columns.
  • foundry_extract() and foundry_embed_batch() show progress bars only in interactive sessions. Set options(foundryR.progress = TRUE) to see them in scripts.
Show all changes in 1.0.0Hide the rest of the changes in 1.0.0
  • foundry_embed_batch() stores only each row's own metadata in raw_response. It used to copy the whole batch response, every embedding included, into every row: 22 MB instead of 2.5 MB in memory for 200 texts.
  • foundry_usage() no longer counts cached input tokens twice. The input token count the service reports includes cached tokens, so the cost is now (input - cached) * input + cached * cached_input + output * output, and cached tokens are billed at the input rate when no cached_input rate is given.
  • foundry_agreement() no longer switches to irr when it is installed. It always uses its own two-coder Krippendorff's alpha, so results no longer depend on which packages are installed. Kappa and alpha are NA, with a warning, when only one category occurs. Macro precision, recall, and F1 use one label set and drop classes whose value is undefined, with a warning, as yardstick does. It also warns when the two label sets differ and reports how many incomplete pairs it dropped.
  • foundry_consistency() compares records after sorting their keys, at full numeric precision. Key order no longer counts as a disagreement, and values are no longer rounded to four decimals before comparison.
  • foundry_provenance() records a 64-character SHA-256 schema hash, the same one foundry_codebook() uses, and a UTC timestamp. Hashes recorded by 0.1.0 will not match.
  • step_foundry_embed() resolves the embedding model at prep() and keeps it, so changing AZURE_FOUNDRY_EMBED_MODEL later no longer changes the model bake() uses. The disk cache key now includes the model and the endpoint.

New features

  • foundry_evaluate() runs a Microsoft Foundry cloud evaluation from a data frame. It creates the evaluation and run, waits for the run, and returns one row per input row and grader with the input columns kept. It grades existing columns, or has Foundry generate responses with a model deployment or agent first (target), and eval_id adds a run to an existing evaluation so runs can be compared. Rows are matched to results through a reserved foundryr_row_id field ("row-1", "row-2", ...) that the service echoes back, never by position. This function and the two below are experimental.
  • foundry_eval_run_wait() polls an evaluation run until it finishes, and foundry_eval_run_results() joins a completed run's grader results to the evaluated data frame.
  • foundry_eval_run_data() builds target runs for model deployments and agents (target, input_messages) and stored-response runs (response_ids). foundry_eval_data_config() gains type = "azure_ai_source" with a scenario argument.
  • Evaluation functions gain a project_endpoint argument. They use the resource endpoint, as in 0.1.0, unless you pass project_endpoint, call foundry_set_route("project"), or the evaluation uses a feature that exists only on a project endpoint: built-in evaluators, a model or agent target, or stored responses. Those calls use the configured project endpoint and print a message saying so. Target and stored-response runs get a default name, which the service requires.
  • Evaluation run tibbles now include per_testing_criteria_results, target latency (target_latency_p50_ms, target_latency_p95_ms, target_latency_samples), and estimated target cost (target_cost, target_cost_currency, target_cost_completeness). Output-item tibbles include the echoed datasource_item and the generated sample_output_text and sample_output_items.
  • foundry_set_route() chooses the default endpoint for the APIs that run on both a resource and a project endpoint: responses, files, vector stores, and evaluations. The default remains the resource endpoint.
  • Conversations now work. The foundry_conversation_*() functions use the project endpoint, the only place conversations exist; in 0.1.0 they called the resource endpoint and always failed with HTTP 404. They gain token and project_endpoint arguments.
  • File and vector store functions gain project_endpoint, and vector store functions gain token, so the files and stores that a server-side agent searches can be created where the agent looks for them.
  • foundry_response() and foundry_extract() gain a token argument.
  • foundry_extract_batch_results() collects a finished extraction batch later, joins the results to the original rows through their row-N IDs, and flattens the fields the way foundry_extract() does. It warns about input rows that have no result. foundry_extract_batch(wait = TRUE) now uses it.
  • foundry_moderate() gains a blocklist_hit column, and foundry_transcribe() gains an enhanced argument.
  • foundry_check_setup() reports project-endpoint authentication and the session route, and shows only the last four characters of an API key.
  • The articles are rewritten around research tasks, and each shows output recorded from live Microsoft Foundry resources. New articles cover evaluations (vignette("evaluations")) and the analysis of evaluation results (vignette("evaluation-analysis")). The comparison with ellmer now lives in the README and vignette("responses-api"). The O*NET article is rewritten as a worked example of matching free-text job descriptions to O*NET-SOC occupations, with its output recorded live.

Deprecated and defunct

  • The video functions foundry_video_job_create(), foundry_video_jobs(), foundry_video_job_get(), foundry_video_job_delete(), foundry_video_get(), and foundry_video_download() are defunct and raise an error. Azure OpenAI retires its last Sora model (sora-2, version 2025-12-08) on 2026-10-15 and has announced no replacement.
  • type_boolean(), type_enum(), type_number(), and type_string() are deprecated in favor of schema_boolean(), schema_enum(), schema_number(), and schema_string(), because they mask ellmer's functions of the same names. To reuse ellmer types, pass them to as_foundry_schema().
  • The bring-your-own-LLM options of foundry_groundedness() (reasoning, correction, and llm_resource) and foundry_llm_resource() are deprecated. They require an Azure OpenAI GPT-4o deployment, and the core groundedness check does not need them.

Bug fixes

  • API errors now keep the service's own message. The old handler replaced any message containing "key" with "Invalid API key" and labeled any 404 "Deployment not found". The hint now depends on the HTTP status and on the endpoint called; for example, a 404 on the resource endpoint mentions that objects created on a project endpoint are not visible there. Empty error bodies and string-valued error fields no longer break error handling.
  • foundry_blocklist_delete() and foundry_blocklist_remove_items() no longer fail after a successful call; the service answers 204 with no body.
  • foundry_blocklist_create() without a description sends {}, not [], which the service rejected. Conversation and vector store updates with no fields send {} as well.
  • foundry_moderate() keeps blocklist matches when a blocklist hit halts analysis and labels those rows "blocked". It used to drop them.
  • foundry_groundedness(correction = TRUE) sends correction, the field the service reads; Microsoft Learn documents mitigating, which the live service ignores. ungrounded_pct is always numeric.
  • foundry_protected_code() checks the service's length requirement, more than 110 characters per snippet, before sending a request.
  • foundry_batch_results() leaves plain-text output as text instead of reporting a JSON parse error, and reads downloaded output as UTF-8. foundry_batch_requests() writes numbers at full precision and missing values as null, and separates lines with \n on every platform; on Windows it used to write \r\n.
  • foundry_embed() and foundry_embed_batch() treat empty strings like missing input: the row gets an error and nothing is sent.
  • foundry_usage() accepts rates as a named list.
  • foundry_transcribe() places transcribe_style under enhancedMode.modelOptions, as Microsoft Learn documents, reports enhanced-mode region failures with guidance, and fills duration_ms from Whisper verbose_json responses.
  • foundry_vector_search() returns the text of each content part rather than the parts' type labels.
  • foundry_eval_delete() warns when the service does not confirm the deletion. A project endpoint has been observed to answer deleted = false and keep the evaluation.
  • Evaluation calls to a project endpoint need a Microsoft Entra ID token. With only an API key they now stop before the request with an explanation, instead of the service's HTTP 403. The other project APIs (responses, agents, conversations, files, and vector stores) accept the resource's API key, as in 0.1.0.
  • foundry_eval_run_results() reports each grader under the name you gave it; the resource endpoint appends an ID to grader names, which is now removed from .grader. For label_model and score_model graders, .label and .reason (and label and reason in foundry_eval_run_output_items()) now hold the judge's chosen label and the conclusions of its reasoning, which were empty.
  • foundry_translate_audio() gives region guidance when the Speech resource cannot translate, including the "specified model is not supported" answer seen in regions without LLM Speech translation.
  • foundry_eval_run_output_items() follows the service's pagination and returns every output item. It previously returned only the first page, which silently truncated larger runs. limit still caps the number of output items returned.
  • codebook_diff() shows key-level changes inside a changed field, such as enum: +workload, instead of cutting values off at 77 characters.
  • foundry_models() is documented correctly: it lists the models available to your resource, not your deployments.
  • foundry_extract() and foundry_extract_batch_results() mark a row as an error when the response carries no structured data, and .error_msg names the reason, such as a refusal, a content-filter stop, a token-limit stop, or JSON that did not parse. These rows used to have empty fields and .error = FALSE, so they looked like valid missing answers.
  • foundry_image() fills output_format for gpt-image models, which report the format once for the whole response instead of once per image.
  • foundry_evaluate(eval_id = ...) reads the item schema of an evaluation stored on a project endpoint, which reports it in a different place from the resource endpoint. It used to warn that it could not read the schema and skip the check that the evaluation can carry your columns.
  • foundry_transcribe() fills language for Speech fast transcription from the locales the service reports on each phrase. It was always NA.
  • foundry_set_token_provider() warns when an Azure CLI provider requests tokens for the wrong kind of endpoint. Project endpoints need https://ai.azure.com tokens and resource endpoints need Cognitive Services tokens. Setup and error messages now suggest foundry_token_azure_cli("https://ai.azure.com") for project endpoints.
  • The 0.1.0 entry below said foundry_agreement() reports Fleiss' kappa. It reports Cohen's kappa and Krippendorff's alpha; the entry has been corrected.
  • foundryR now requires httr2 1.1.1 or later, the version whose features it uses. irr is no longer a suggested package.

From NEWS.md in the release

Install

Health

CRAN checks
13OK
Slowest check: 4.4 min · r-oldrel-windows-x86_64
Status changes
  • OK13 OKNow
  • OK6 OK2026-09-25
Advisories

none known

Documentation

In release 1.0.0
READMEYes · 858 wordsVignettesYes · 12 · evaluation depends on the environmentNEWSYes · 100% structured · mentions 1.0.0Citation fileNoWebsiteYes · pkgdown

The repository also keeps web-only articles.

Help pages
133 (25 internal)includes a package overview page
Examples that run
47%50 run in a plain check (12 of them under a condition) · 1 only when donttest examples are enabled (R CMD check --as-cran) · 55 never run
Exported functions with examples
99%
Documented parameters
98%
Return-value docs
100%
Help pages citing references
3%

Downloads

563
CRAN downloads in the past year
Rank #23,265 · ~2/day · ~47/mo
Daily download trend is not available in this view yet.
56330 days
56390 days
5631 year
Compare downloads with other packages →
Also on5 r2u

Repository

1Stars
0Forks
1Open issues
0Open PRs
2Releases
95Commits
1Commit identities
95 commits · Last activity 2026-10-01 · Default branch at 1.0.0.9000, ahead of CRAN 1.0.0 (checked 2026-10-22)
Responsiveness
How these are sampled
PRs merged (all time)
93%
Median days to close, 50 most recently updated closed issues
4
Median days to close, 50 most recently updated closed PRs
0

Releases over time

2026-09-25 · 02026-10-02 · 2
PracticesBeta

9 development-tooling and community-health practices detected across 5 families in the upstream repository

Checks run against github.com/farach/foundryr on 2026-10-22.

Continuous integration (2)
GitHub ActionsR CMD check workflow

The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel

Docs source (4)
README.Rmdpkgdown

GitHub Pages site last deployed 2026-10-01 · The repository has a site deploy workflow

pkgdown site last built 2026-10-01

Reproducibility and dev environment (1)
data-raw/
CRAN release process (1)
cran-comments.md
Show all practicesHide 1 practice
Lint, format, editor (1)
lintr
How this is detected·Detection ruleset v4 (2026-10-20)
AI coding toolsBeta

This repository shows signs of AI coding tools.

  • GitHub Copilotfirst seen 2026-06-03
    Commits: at least 65 crediting it in the message
Counts are commits, not lines of code. Commits by a tool's accounts count once across all of its accounts. Commits crediting it are the largest count among its credit lines, a minimum.How this is detected·Detection ruleset v4 (updated 2026-09-27)

Dependencies

Declared dependencies
29 external dependencies (excludes base and recommended)

Installing foundryR adds 23 packages (16 with compiled code, 8.8 MB of source tarballs). Heaviest: openssl 1.1 MB, jsonlite 1.0 MB, vctrs 1.0 MB.

Depends (1)
R >= 4.1.0
LinkingTo (0)
none
Enhances (0)
none
Reverse dependencies
0direct
0indirect

Nothing depends on this yet.

People & History

People (1)
Author, Maintainer since 0.1.0 (2026), Copyright holder
Releases (2)

Pick two releases to compare their code metrics.

  • 1.0.0Latest
    record
    2026-10-01 · current release · diff ↗ ·
    added 5 exports
    foundry_eval_run_results, foundry_eval_run_wait, foundry_evaluate, foundry_extract_batch_results, foundry_set_route
  • 0.1.0
    record
    2026-09-24
  • R
    R 4.6.0 released · 2026-04-24

Package metadata

First published
2026-09-24
Total releases
2 / 1 yrs
License
MIT + file LICENSE OSI
Minimum R
≥ 4.1.0
Download size
1.7 MB

Cite

Cite this package

Run in R for the authors' preferred citation:

citation("foundryR")
Farach, A. (2026). foundryR: Data Frame Workflows for 'Microsoft Foundry' (Version 1.0.0) [Computer software]. https://doi.org/10.32614/CRAN.package.foundryR

This package has no citation file, so citation() returns this entry built from DESCRIPTION.

Cite the R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for foundryR version 1.0.0 [Data set]. HJJB, LLC. Data release v2026-10-24. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-24, which the citation names so these numbers can be found later. More on citing and the projects behind them.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy