Skip to contents

Getting Started

Essential functions for setting up and managing API keys

set_api_key()
Set your API keys so they can be accessed by EndpointR
get_api_key()
Retrieve an API key which has been stored as an Environment Variable.

Hugging Face - Text Embeddings

Functions for generating text embeddings using Hugging Face endpoints

hf_embed_text()
Generate embeddings for a single text
hf_embed_batch()
Generate batches of embeddings for a list of texts
hf_embed_df()
Generate embeddings for texts in a data frame
tidy_embedding_response()
Process embedding API response into a tidy format

Hugging Face - Text Classification

Functions for classifying text using Hugging Face endpoints

hf_classify_text()
Classify text using a Hugging Face Inference API endpoint
hf_classify_batch()
Classify multiple texts using Hugging Face Inference Endpoints
hf_classify_df()
Classify a data frame of texts using Hugging Face Inference Endpoints
tidy_classification_response()
Convert Hugging Face classification response to tidy format

Hugging Face - Core Infrastructure

Low-level functions for building and performing Hugging Face requests

hf_build_request()
Prepare a single text embedding request
hf_build_request_batch()
Prepare a batch request for multiple texts
hf_build_request_df()
Prepare embedding requests for texts in a data frame
hf_perform_request()
Execute a single embedding request and process the response

OpenAI Completions

Functions for working with OpenAI’s APIs including structured outputs

oai_build_completions_request()
Build an OpenAI API Chat Completions request
oai_build_completions_request_list()
Build OpenAI requests for batch processing
oai_complete_text()
Generate a completion for a single text using OpenAI's Chat Completions API
oai_complete_chunks()
Process text chunks through OpenAI's Chat Completions API with batch file output
oai_complete_df()
Process a data frame through OpenAI's Chat Completions API with chunked processing

OpenAI Embeddings

Functions for extracting embeddings with OpenAI’s text embedding models

oai_build_embedding_request()
Build OpenAI embedding API request
oai_embed_text()
Generate embeddings for a single text using OpenAI
oai_embed_batch()
Generate embeddings for multiple texts using OpenAI
oai_embed_df()
Generate embeddings for texts in a data frame using OpenAI
tidy_oai_embedding()
Process OpenAI embedding API response into a tidy format

JSON Schema for Structured Outputs

Type-safe schema creation and validation for structured LLM outputs

create_json_schema()
Create a JSON Schema object
json_schema()
Create JSON Schema S7 class for structured outputs
json_dump
Convert json_schema to API format
validate_response
Validate response data against schema

Schema Builders

Helper functions for creating different types of JSON schema properties

schema_object()
Create JSON Schema object definitions
schema_string()
Create string property schema
schema_number()
Create numeric property schema
schema_integer()
Create integer property schema
schema_boolean()
Create boolean property schema
schema_enum()
Create enumerated property schema
schema_array()
Create array property schema

Core Utilities

Internal utility functions and data processing helpers

safely_perform_request()
Safely perform an embedding request with error handling
chunk_dataframe()
Split a data frame into chunks for batch processing
perform_requests_with_strategy()
Perform multiple requests with configurable concurrency strategy
process_response()
Process API response with error handling
hf_perform_request()
Execute a single embedding request and process the response
validate_hf_endpoint()
Validate that a Hugging Face Inference Endpoint is available
base_request()
Create a base HTTP POST request for API endpoints

Sample Data

Datasets included with the package for examples and testing

batch_concurrent_benchmark
Batch concurrent benchmark results
sentiment_classification_example
Single sentiment classification result example
df_sentiment_classification_example
Example sentiment classification results from Hugging Face API
single_embedding_hf
Single embedding result example from Hugging Face API
df_embeddings_hf
Example embedding results from Hugging Face API