Crate batch_mode_batch_workflow

Source

Modules§

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

Macros§

impl_default_save_to_file_traits

Structs§

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.
BatchExecutionResult
BatchExecutionResultBuilder
Builder for BatchExecutionResult.
BatchFileReconciliationRecommendedCourseOfAction
BatchFileTriple
Represents the batch files associated with a specific index.
BatchFileTripleBuilder
Builder for BatchFileTriple.
BatchMetadata
BatchMetadataBuilder
Builder for BatchMetadata.
BatchOnlineStatus
BatchRequestId
BatchWorkspace
BatchWorkspaceBuilder
Builder for BatchWorkspace.
CustomRequestId
FailingWorkspace
LanguageModelBatchAPIRequest
Represents the complete request structure.
LanguageModelMessage
Individual message details in the request body.
LanguageModelRequestBody
Body details of the API request.
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

Enums§

BatchDownloadError
BatchErrorFileProcessingOperation
BatchErrorProcessingError
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
BatchInputCreationError
BatchMetadataBuilderError
Error type for BatchMetadataBuilder
BatchMetadataError
BatchOutputProcessingError
BatchProcessingError
BatchReconciliationError
BatchSuccessResponseHandlingError
BatchValidationError
BatchWorkspaceBuilderError
Error type for BatchWorkspaceBuilder
BatchWorkspaceError
ErrorSavingFailedBatchEntries
ExpectedContentType
FileMoveError
HttpMethod
Enumeration of possible HTTP methods.
JsonParseError
LanguageModelApiUrl
Enumeration of API URLs.
LanguageModelBatchCreationError
LanguageModelBatchWorkflowError
LanguageModelMessageRole
Enumeration of roles in a message.
LanguageModelType
Supported model types.
MockBatchClientError
MockBatchConfigBuilderError
Error type for MockBatchConfigBuilder
MockBatchWorkspaceBuilderError
Error type for MockBatchWorkspaceBuilder
MockLanguageModelClientBuilderError
Error type for MockLanguageModelClientBuilder
OpenAIClientError
ParseTokenDescriptionLineError
RigorousJsonCommandBuilderStage
SaveLoadError
TokenizerError

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.
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
DeepClone
DownloadErrorFile
DownloadOutputFile
ExecuteReconciliationOperation
FindExistingBatchFileIndices
FindSimilarTargetPath
FinishProcessingUncompletedBatches
FreshExecute
FullBatchWorkspaceInterface
GatherAllBatchTriples
GetBatchFileContent
GetBatchWorkspace
GetDoneDirectory
GetErrorFilenameAtIndex
GetFailedItemsDir
GetFailedJsonRepairsDir
GetInputFilenameAtIndex
GetLanguageModelClient
GetMetadataFilenameAtIndex
GetOutputFilenameAtIndex
GetTargetDir
GetTargetDirectoryFiles
GetTargetPath
GetTargetPathForAIExpansion
GetTargetPathForAIExpansionFromSeed
GetTextStoragePath
GetWorkdir
HasAssociatedOutputName
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
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.
handle_failed_json_repair
handle_finish_reason_length
handle_successful_response
make_valid_lmb_api_request_json_mock
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

Attribute Macros§

async_trait

Derive Macros§

AiJsonTemplate

Trait Aliases§

OpenAIConfigInterface