Data Frame Workflows for 'Microsoft Foundry'
Overview
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/.
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 withmai-transcribe-1.5, is rejected in many regions, including East US 2. Passmodel = "mai-transcribe-2"or the newenhanced = TRUEto 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()andfoundry_translate_audio()withservice = "openai", andfoundry_speak()) now require an explicitmodeldeployment name instead of falling back toAZURE_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 forpurpose = "assistants", which is the default purpose, so default uploads failed. Passexpires_after_secondsto 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()andfoundry_shield()keep the full input text instead of truncating it, and gain an.input_idxcolumn 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 ablocklist_hitcolumn.foundry_moderate(),foundry_shield(), andfoundry_groundedness()returnNAwhen 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 JSONnullbecomes a typedNA, 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()andfoundry_embed_batch()show progress bars only in interactive sessions. Setoptions(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 inraw_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 theinputrate when nocached_inputrate 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 areNA, 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 onefoundry_codebook()uses, and a UTC timestamp. Hashes recorded by 0.1.0 will not match.step_foundry_embed()resolves the embedding model atprep()and keeps it, so changingAZURE_FOUNDRY_EMBED_MODELlater no longer changes the modelbake()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), andeval_idadds a run to an existing evaluation so runs can be compared. Rows are matched to results through a reservedfoundryr_row_idfield ("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, andfoundry_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()gainstype = "azure_ai_source"with ascenarioargument.- Evaluation functions gain a
project_endpointargument. They use the resource endpoint, as in 0.1.0, unless you passproject_endpoint, callfoundry_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 echoeddatasource_itemand the generatedsample_output_textandsample_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 gaintokenandproject_endpointarguments. - File and vector store functions gain
project_endpoint, and vector store functions gaintoken, so the files and stores that a server-side agent searches can be created where the agent looks for them. foundry_response()andfoundry_extract()gain atokenargument.foundry_extract_batch_results()collects a finished extraction batch later, joins the results to the original rows through theirrow-NIDs, and flattens the fields the wayfoundry_extract()does. It warns about input rows that have no result.foundry_extract_batch(wait = TRUE)now uses it.foundry_moderate()gains ablocklist_hitcolumn, andfoundry_transcribe()gains anenhancedargument.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 andvignette("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(), andfoundry_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(), andtype_string()are deprecated in favor ofschema_boolean(),schema_enum(),schema_number(), andschema_string(), because they mask ellmer's functions of the same names. To reuse ellmer types, pass them toas_foundry_schema().- The bring-your-own-LLM options of
foundry_groundedness()(reasoning,correction, andllm_resource) andfoundry_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
errorfields no longer break error handling. foundry_blocklist_delete()andfoundry_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)sendscorrection, the field the service reads; Microsoft Learn documentsmitigating, which the live service ignores.ungrounded_pctis 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 asnull, and separates lines with\non every platform; on Windows it used to write\r\n.foundry_embed()andfoundry_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()placestranscribe_styleunderenhancedMode.modelOptions, as Microsoft Learn documents, reports enhanced-mode region failures with guidance, and fillsduration_msfrom Whisperverbose_jsonresponses.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 answerdeleted = falseand 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. Forlabel_modelandscore_modelgraders,.labeland.reason(andlabelandreasoninfoundry_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.limitstill caps the number of output items returned.codebook_diff()shows key-level changes inside a changed field, such asenum: +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()andfoundry_extract_batch_results()mark a row as an error when the response carries no structured data, and.error_msgnames 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()fillsoutput_formatfor 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()fillslanguagefor Speech fast transcription from the locales the service reports on each phrase. It was alwaysNA.foundry_set_token_provider()warns when an Azure CLI provider requests tokens for the wrong kind of endpoint. Project endpoints needhttps://ai.azure.comtokens and resource endpoints need Cognitive Services tokens. Setup and error messages now suggestfoundry_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
- OK13 OKNow
- OK6 OK2026-09-25
Documentation
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%
- Analyze evaluation results with uncertainty HTML
- Annotate at scale with the Batch API HTML
- API support matrix HTML
- Content Safety gates in a research pipeline HTML
- Embeddings for research HTML
- Embeddings in tidymodels recipes HTML
- Evaluate models and agents in Microsoft Foundry HTML
- From text to defensible estimates HTML
- Generate images HTML
- Get started with foundryR HTML
Show 2 moreHide 2 vignettes
Downloads
Repository
- 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
Issues over time
PRs over time
Commits over time
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.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-10-01 · The repository has a site deploy workflow
pkgdown site last built 2026-10-01
Show all practicesHide 1 practice
This repository shows signs of AI coding tools.
- GitHub Copilotfirst seen 2026-06-03Commits: at least 65 crediting it in the message
Dependencies
Code & Tests
People & History
Pick two releases to compare their code metrics.
- 1.0.0Latest2026-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.02026-09-24
- RR 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")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.
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.