language_model_batch_workflow_derive/
lib.rs1#[macro_use] mod imports; use imports::*;
11
12xp!{combine_impls_into_final_macro}
13xp!{finish_processing_uncompleted_batches}
14xp!{get_batch_workspace}
15xp!{get_language_model_client}
16xp!{language_model_batch_workflow}
17xp!{process_batch_requests}
18xp!{send_sync}
19xp!{lmbw_parsed_input}
20xp!{parse_derive_input_for_lmbw}
21xp!{gather_results}
22
23#[proc_macro_derive(
24 LanguageModelBatchWorkflow,
25 attributes(
26 batch_json_output_format,
27 batch_client,
28 batch_workspace,
29 custom_process_batch_output_fn,
30 custom_process_batch_error_fn,
31 expected_content_type,
32 model_type,
33 batch_mode_json_output_format_is_the_first_generic,
34 batch_error_type
35 )
36)]
37pub fn language_model_batch_workflow_derive(input: TokenStream) -> TokenStream {
38 tracing::trace!("Entering language_model_batch_workflow_derive proc macro.");
39
40 let ast: DeriveInput = syn::parse_macro_input!(input as DeriveInput);
41
42 let parse_result = match parse_derive_input_for_lmbw(&ast) {
43 Ok(x) => x,
44 Err(e) => return e.to_compile_error().into(),
45 };
46
47 let finish_processing_impl = generate_impl_finish_processing_uncompleted_batches(&parse_result);
49 let process_batch_requests_impl = generate_impl_process_batch_requests(&parse_result);
50 let workflow_impl = generate_impl_language_model_batch_workflow(&parse_result);
51 let send_sync_impl = generate_impl_send_sync(&parse_result);
52 let get_workspace_impl = generate_impl_get_batch_workspace(&parse_result);
53 let get_client_impl = generate_impl_get_language_model_client(&parse_result);
54
55 let gather_results_trait_impl = generate_impl_gather_results_trait(&parse_result);
57
58 let expanded = combine_impls_into_final_macro(vec![
59 finish_processing_impl,
60 process_batch_requests_impl,
61 workflow_impl,
62 send_sync_impl,
63 get_workspace_impl,
64 get_client_impl,
65 gather_results_trait_impl,
66 ]);
67
68 tracing::trace!("Exiting language_model_batch_workflow_derive proc macro.");
69 expanded.into()
70}