Crate batch_mode

Source

Modules§

language_model_output_format_instructions
model_type
tokio
A runtime for writing reliable network applications without compromising speed.

Macros§

impl_default_save_to_file_traits

Structs§

AgentCoordinate
AgentCoordinateBuilder
Builder for AgentCoordinate.
BadWorkspace
In “test_reconcile_unprocessed_input_error_but_mock_processing_fails_action,” you had a local struct BadWorkspace referencing workspace_dir(). Instead, remove that workspace_dir() method entirely, and define a single “BadWorkspace” with full trait impl so it compiles.
BatchChoice
BatchChoiceBuilder
Builder for BatchChoice.
BatchErrorData
BatchErrorDataBuilder
Builder for BatchErrorData.
BatchErrorDetails
BatchErrorDetailsBuilder
Builder for BatchErrorDetails.
BatchErrorResponseBody
BatchErrorResponseBodyBuilder
Builder for BatchErrorResponseBody.
BatchExecutionResult
BatchExecutionResultBuilder
Builder for BatchExecutionResult.
BatchFileReconciliationRecommendedCourseOfAction
BatchFileTriple
Represents the batch files associated with a specific index.
BatchFileTripleBuilder
Builder for BatchFileTriple.
BatchInputData
BatchInputDataBuilder
Builder for BatchInputData.
BatchMessage
BatchMessageBuilder
Builder for BatchMessage.
BatchMessageContent
BatchMessageContentBuilder
Builder for BatchMessageContent.
BatchMetadata
BatchMetadataBuilder
Builder for BatchMetadata.
BatchOnlineStatus
BatchOutputData
BatchOutputDataBuilder
Builder for BatchOutputData.
BatchRequestId
BatchRequestRecord
BatchRequestRecordBuilder
Builder for BatchRequestRecord.
BatchResponseContent
BatchResponseContentBuilder
Builder for BatchResponseContent.
BatchResponseRecord
BatchResponseRecordBuilder
Builder for BatchResponseRecord.
BatchSuccessResponseBody
BatchSuccessResponseBodyBuilder
Builder for BatchSuccessResponseBody.
BatchTokenDetails
BatchTokenDetailsBuilder
Builder for BatchTokenDetails.
BatchUsage
BatchUsageBuilder
Builder for BatchUsage.
BatchWorkspace
BatchWorkspaceBuilder
Builder for BatchWorkspace.
CamelCaseTokenWithComment
CamelCaseTokenWithCommentBuilder
Builder for CamelCaseTokenWithComment.
CustomRequestId
FailingWorkspace
InstructedLanguageModelAtCoordinate
InstructedLanguageModelAtCoordinateBuilder
Builder for InstructedLanguageModelAtCoordinate.
LanguageModelBatchAPIRequest
Represents the complete request structure.
LanguageModelMessage
Individual message details in the request body.
LanguageModelRequestBody
Body details of the API request.
LanguageModelTokenExpander
MockBatchConfig
MockBatchConfigBuilder
Builder for MockBatchConfig.
MockBatchWorkspace
MockBatchWorkspaceBuilder
Builder for MockBatchWorkspace.
MockItem
A minimal item that could implement GetTargetPathForAIExpansion. We’ll just call it MockItem for demonstration.
MockLanguageModelClient
MockLanguageModelClientBuilder
Builder for MockLanguageModelClient.
OpenAIClientHandle
ResponseRequestId
SystemMessageHeader
TokenPackagedForExpansion

Enums§

AgentCoordinateBuilderError
Error type for AgentCoordinateBuilder
BatchChoiceBuilderError
Error type for BatchChoiceBuilder
BatchDownloadError
BatchErrorDataBuilderError
Error type for BatchErrorDataBuilder
BatchErrorDetailsBuilderError
Error type for BatchErrorDetailsBuilder
BatchErrorFileProcessingOperation
BatchErrorProcessingError
BatchErrorResponseBodyBuilderError
Error type for BatchErrorResponseBodyBuilder
BatchExecutionResultBuilderError
Error type for BatchExecutionResultBuilder
BatchFileState
Represents the state of batch files based on the presence of input, output, and error files.
BatchFileTripleBuilderError
Error type for BatchFileTripleBuilder
BatchFileTripleReconciliationOperation
BatchIndex
Represents the type of index found in the file names.
BatchIndexType
BatchInputCreationError
BatchInputDataBuilderError
Error type for BatchInputDataBuilder
BatchMessageBuilderError
Error type for BatchMessageBuilder
BatchMessageContentBuilderError
Error type for BatchMessageContentBuilder
BatchMetadataBuilderError
Error type for BatchMetadataBuilder
BatchMetadataError
BatchOutputDataBuilderError
Error type for BatchOutputDataBuilder
BatchOutputProcessingError
BatchProcessingError
BatchReconciliationError
BatchRequestRecordBuilderError
Error type for BatchRequestRecordBuilder
BatchResponseBody
BatchResponseContentBuilderError
Error type for BatchResponseContentBuilder
BatchResponseRecordBuilderError
Error type for BatchResponseRecordBuilder
BatchSuccessResponseBodyBuilderError
Error type for BatchSuccessResponseBodyBuilder
BatchSuccessResponseHandlingError
BatchTokenDetailsBuilderError
Error type for BatchTokenDetailsBuilder
BatchUsageBuilderError
Error type for BatchUsageBuilder
BatchValidationError
BatchWorkspaceBuilderError
Error type for BatchWorkspaceBuilder
BatchWorkspaceError
CamelCaseTokenWithCommentBuilderError
Error type for CamelCaseTokenWithCommentBuilder
ContentParseError
ErrorSavingFailedBatchEntries
ErrorType
ExpectedContentType
FileMoveError
FinishReason
HttpMethod
Enumeration of possible HTTP methods.
InstructedLanguageModelAtCoordinateBuilderError
Error type for InstructedLanguageModelAtCoordinateBuilder
JsonParseError
LanguageModelApiUrl
Enumeration of API URLs.
LanguageModelBatchCreationError
LanguageModelBatchWorkflowError
LanguageModelMessageRole
Enumeration of roles in a message.
LanguageModelOutputFormatInstruction
LanguageModelType
Supported model types.
MessageRole
MockBatchClientError
MockBatchConfigBuilderError
Error type for MockBatchConfigBuilder
MockBatchWorkspaceBuilderError
Error type for MockBatchWorkspaceBuilder
MockLanguageModelClientBuilderError
Error type for MockLanguageModelClientBuilder
OpenAIClientError
ParseTokenDescriptionLineError
RigorousJsonCommandBuilderStage
SaveLoadError
TokenExpanderError
TokenExpansionStep
TokenParseError
TokenizerError
UuidParseError

Constants§

DEFAULT_OUTPUT_FILE_BRIDGE
The const pointer the macro references.
PROCESS_ERROR_FILE_BRIDGE
We expose a CONST of type BatchWorkflowProcessErrorFileFn, so passing &PROCESS_ERROR_FILE_BRIDGE exactly matches the trait’s needed function pointer type.

Traits§

AiJsonTemplate
The derived code implements AiJsonTemplate for each struct, letting you call MyStruct::to_template() to get a JSON “schema” describing how the AI should produce data that matches this layout.
AxisDescription
A trait that describes the axis in textual form. Implementations usually associate a descriptive string per enum variant, used for instructing the end user or prompting an LLM how to expand that axis.
AxisName
A trait that describes the name of an axis. Implementations usually associate one distinct axis name string per enum variant.
BatchWorkspaceInterface
CalculateUnseenInputs
CheckAndDownloadInterface
CheckBatchStatusOnline
CheckForAndDownloadOutputAndErrorOnline
CloneAsFreshTemporary
A trait defining how to “deep clone” a BatchWorkspace into a fully fresh temporary directory, replicating its directory structure (workdir, logs, done, etc.), as well as copying over any existing files.
ComputeLanguageModelCoreQuery
ComputeLanguageModelRequests
This is the trait we will typically need to implement manually
ComputeSystemMessage
Two new traits that users must implement:
CreateBatch
CreateLanguageModelQueryAtAgentCoordinate
DeepClone
DownloadErrorFile
DownloadOutputFile
ExecuteReconciliationOperation
ExpandedToken
This trait marks types which represent expanded tokens. It is helpful to have a way to treat them generically
FilePattern
FindExistingBatchFileIndices
FindSimilarTargetPath
FinishProcessingUncompletedBatches
FreshExecute
FullBatchWorkspaceInterface
GatherAllBatchTriples
GetBatchFileContent
GetBatchWorkspace
GetDoneDirectory
GetErrorFilenameAtIndex
GetFailedItemsDir
GetFailedJsonRepairsDir
GetInputFilenameAtIndex
GetLanguageModelClient
GetMetadataFilenameAtIndex
GetOutputFilenameAtIndex
GetSystemMessageAtAgentCoordinate
GetTargetDir
GetTargetDirectoryFiles
GetTargetPath
GetTargetPathForAIExpansion
GetTargetPathForAIExpansionFromSeed
GetTextStoragePath
GetTokenExpansionAxes
GetWorkdir
HasAssociatedOutputName
IntoLanguageModelQueryString
LanguageModelBatchWorkflow
Trait describing a more general “batch workflow” specialized to GPT expansions.
LanguageModelBatchWorkflowGatherResults
This new trait is used to gather the final AI expansions from disk, matching each seed item to its parsed output JSON.
LanguageModelClientInterface
LoadFromDirectory
Trait for loading objects from a directory asynchronously.
LoadFromFile
LocateBatchFiles
ProcessBatchRequests
RecalculateRecommendedActions
ReconcileUnprocessed
Trait describing how a BatchFileTriple can be reconciled if unprocessed.
RetrieveBatchById
SaveToFile
SystemMessageGoal
A trait that describes the system message goal for a given axis set. This is typically implemented for the entire enum and returns a single, static system message goal string for the entire type.
TokenExpander
This trait we use as a generic expander of tokens. It leverages a collection of TokenExpanderAxes and has its implementation typically automatically generated by the TokenExpansionAxis proc macro
TokenExpansionAxis
Trait defining the capabilities of a TokenExpansionAxis.
UploadBatchFileCore
UploadBatchFileExt
WaitForBatchCompletion

Functions§

construct_batches
Break requests into workable batches.
create_batch_input_file
default_output_file_bridge_fn
A default bridging function, if the user doesn’t specify a particular T type. We’ll parse each line as a CamelCaseTokenWithComment or whichever default type we prefer.
extract_json_from_possible_backticks_block
Extracts JSON from a content string by removing surrounding json\n and \n markers if present, and trims any leading or trailing whitespace from the input.
extract_token_name_field
Extracts the “token_name” field from a JSON object.
handle_failed_json_repair
handle_finish_reason_length
handle_successful_response
load_error_file
ALL-OR-NOTHING loader for the error file.
load_input_file
ALL-OR-NOTHING loader for the input file.
load_output_file
ALL-OR-NOTHING loader for the output file.
make_valid_lmb_api_request_json_mock
parse_token_file
process_batch_output_and_errors
We add 'static + Send + Sync to T, so that storing it in an Arc<dyn ... + Send + Sync + 'static> is valid and the resulting Future can be Send.
process_error_data
process_error_file
This is the real async function that processes the error file for a given triple,using the list of error operations. Now uses NDJSON approach line by line.
process_output_data
process_output_file
The core async function to process the output file for a given triple.Now we do NDJSON line-by-line parsing, just like the older batch-mode approach.
process_output_file_bridge_fn
The bridging function EXACTLY matches the BatchWorkflowProcessOutputFileFn type:
save_failed_entries
write_to_file
Writes serialized JSON content to a file asynchronously.

Type Aliases§

BatchWorkflowProcessErrorFileFn
BatchWorkflowProcessOutputFileFn
LanguageModelClientArc
TokenExpansionAxes
TokenQuad

Attribute Macros§

async_trait

Derive Macros§

AiJsonTemplate
LanguageModelBatchWorkflow
SaveLoad
TokenExpansionAxis

Trait Aliases§

OpenAIConfigInterface