@@ -19,8 +19,8 @@ use crate::{
1919use crate :: {
2020 ChatCompletion , ChatCompletionChoice , ChatCompletionChunk , ChatCompletionComplete ,
2121 ChatCompletionDelta , ChatCompletionLogprob , ChatCompletionLogprobs , ChatCompletionTopLogprob ,
22- ChatRequest , CompatGenerateRequest , Completion , CompletionComplete , CompletionCompleteChunk ,
23- CompletionRequest , CompletionType , DeltaToolCall , Function , Tool , VertexRequest ,
22+ ChatRequest , Chunk , CompatGenerateRequest , Completion , CompletionComplete , CompletionFinal ,
23+ CompletionRequest , CompletionType , DeltaToolCall , Function , Prompt , Tool , VertexRequest ,
2424 VertexResponse ,
2525} ;
2626use crate :: { FunctionDefinition , HubPreprocessorConfig , ToolCall , ToolType } ;
@@ -705,7 +705,7 @@ async fn completions(
705705 . as_secs ( ) ;
706706
707707 event
708- . json_data ( CompletionCompleteChunk {
708+ . json_data ( Completion :: Chunk ( Chunk {
709709 id : "" . to_string ( ) ,
710710 created : current_time,
711711
@@ -718,7 +718,7 @@ async fn completions(
718718
719719 model : model_id. clone ( ) ,
720720 system_fingerprint : system_fingerprint. clone ( ) ,
721- } )
721+ } ) )
722722 . unwrap_or_else ( |_e| Event :: default ( ) )
723723 } ;
724724
@@ -931,7 +931,7 @@ async fn completions(
931931 . collect :: < Result < Vec < _ > , _ > > ( )
932932 . map_err ( |( status, Json ( err) ) | ( status, Json ( err) ) ) ?;
933933
934- let response = Completion {
934+ let response = Completion :: Final ( CompletionFinal {
935935 id : "" . to_string ( ) ,
936936 created : current_time,
937937 model : info. model_id . clone ( ) ,
@@ -946,7 +946,7 @@ async fn completions(
946946 completion_tokens,
947947 total_tokens,
948948 } ,
949- } ;
949+ } ) ;
950950
951951 // headers similar to `generate` but aggregated
952952 let mut headers = HeaderMap :: new ( ) ;
@@ -1464,7 +1464,10 @@ pub async fn run(
14641464 ChatCompletion ,
14651465 CompletionRequest ,
14661466 CompletionComplete ,
1467- CompletionCompleteChunk ,
1467+ Chunk ,
1468+ Completion ,
1469+ CompletionFinal ,
1470+ Prompt ,
14681471 GenerateParameters ,
14691472 PrefillToken ,
14701473 Token ,
0 commit comments