@@ -224,7 +224,7 @@ public override async Task<ChatResponse> GetResponseAsync(
224224        List < ChatMessage > ?  responseMessages  =  null ;  // tracked list of messages, across multiple turns, to be used for the final response 
225225        UsageDetails ?  totalUsage  =  null ;  // tracked usage across all turns, to be used for the final response 
226226        List < FunctionCallContent > ?  functionCallContents  =  null ;  // function call contents that need responding to in the current turn 
227-         bool  lastIterationHadThreadId  =  false ;  // whether the last iteration's response had a ChatThreadId  set 
227+         bool  lastIterationHadConversationId  =  false ;  // whether the last iteration's response had a ConversationId  set 
228228        int  consecutiveErrorCount  =  0 ; 
229229
230230        for  ( int  iteration  =  0 ;  ;  iteration ++ ) 
@@ -274,7 +274,7 @@ public override async Task<ChatResponse> GetResponseAsync(
274274            } 
275275
276276            // Prepare the history for the next iteration. 
277-             FixupHistories ( originalMessages ,  ref  messages ,  ref  augmentedHistory ,  response ,  responseMessages ,  ref  lastIterationHadThreadId ) ; 
277+             FixupHistories ( originalMessages ,  ref  messages ,  ref  augmentedHistory ,  response ,  responseMessages ,  ref  lastIterationHadConversationId ) ; 
278278
279279            // Add the responses from the function calls into the augmented history and also into the tracked 
280280            // list of response messages. 
@@ -287,7 +287,7 @@ public override async Task<ChatResponse> GetResponseAsync(
287287                break ; 
288288            } 
289289
290-             UpdateOptionsForNextIteration ( ref  options ! ,  response . ChatThreadId ) ; 
290+             UpdateOptionsForNextIteration ( ref  options ! ,  response . ConversationId ) ; 
291291        } 
292292
293293        Debug . Assert ( responseMessages  is  not null ,  "Expected to only be here if we have response messages." ) ; 
@@ -318,7 +318,7 @@ public override async IAsyncEnumerable<ChatResponseUpdate> GetStreamingResponseA
318318        List < ChatMessage > ?  augmentedHistory  =  null ;  // the actual history of messages sent on turns other than the first 
319319        List < FunctionCallContent > ?  functionCallContents  =  null ;  // function call contents that need responding to in the current turn 
320320        List < ChatMessage > ?  responseMessages  =  null ;  // tracked list of messages, across multiple turns, to be used in fallback cases to reconstitute history 
321-         bool  lastIterationHadThreadId  =  false ;  // whether the last iteration's response had a ChatThreadId  set 
321+         bool  lastIterationHadConversationId  =  false ;  // whether the last iteration's response had a ConversationId  set 
322322        List < ChatResponseUpdate >  updates  =  [ ] ;  // updates from the current response 
323323        int  consecutiveErrorCount  =  0 ; 
324324
@@ -368,7 +368,7 @@ public override async IAsyncEnumerable<ChatResponseUpdate> GetStreamingResponseA
368368            ( responseMessages  ??=  [ ] ) . AddRange ( response . Messages ) ; 
369369
370370            // Prepare the history for the next iteration. 
371-             FixupHistories ( originalMessages ,  ref  messages ,  ref  augmentedHistory ,  response ,  responseMessages ,  ref  lastIterationHadThreadId ) ; 
371+             FixupHistories ( originalMessages ,  ref  messages ,  ref  augmentedHistory ,  response ,  responseMessages ,  ref  lastIterationHadConversationId ) ; 
372372
373373            // Process all of the functions, adding their results into the history. 
374374            var  modeAndMessages  =  await  ProcessFunctionCallsAsync ( augmentedHistory ,  options ,  functionCallContents ,  iteration ,  consecutiveErrorCount ,  cancellationToken ) ; 
@@ -390,7 +390,7 @@ public override async IAsyncEnumerable<ChatResponseUpdate> GetStreamingResponseA
390390                { 
391391                    AdditionalProperties  =  message . AdditionalProperties , 
392392                    AuthorName  =  message . AuthorName , 
393-                     ChatThreadId  =  response . ChatThreadId , 
393+                     ConversationId  =  response . ConversationId , 
394394                    CreatedAt  =  DateTimeOffset . UtcNow , 
395395                    Contents  =  message . Contents , 
396396                    RawRepresentation  =  message . RawRepresentation , 
@@ -408,7 +408,7 @@ public override async IAsyncEnumerable<ChatResponseUpdate> GetStreamingResponseA
408408                break ; 
409409            } 
410410
411-             UpdateOptionsForNextIteration ( ref  options ,  response . ChatThreadId ) ; 
411+             UpdateOptionsForNextIteration ( ref  options ,  response . ConversationId ) ; 
412412        } 
413413
414414        AddUsageTags ( activity ,  totalUsage ) ; 
@@ -437,18 +437,18 @@ private static void AddUsageTags(Activity? activity, UsageDetails? usage)
437437    /// <param name="augmentedHistory">The augmented history containing all the messages to be sent.</param> 
438438    /// <param name="response">The most recent response being handled.</param> 
439439    /// <param name="allTurnsResponseMessages">A list of all response messages received up until this point.</param> 
440-     /// <param name="lastIterationHadThreadId ">Whether the previous iteration's response had a thread  id.</param> 
440+     /// <param name="lastIterationHadConversationId ">Whether the previous iteration's response had a conversation  id.</param> 
441441    private  static   void  FixupHistories ( 
442442        IEnumerable < ChatMessage >  originalMessages , 
443443        ref  IEnumerable < ChatMessage >  messages , 
444444        [ NotNull ]  ref  List < ChatMessage > ?  augmentedHistory , 
445445        ChatResponse  response , 
446446        List < ChatMessage >  allTurnsResponseMessages , 
447-         ref  bool  lastIterationHadThreadId ) 
447+         ref  bool  lastIterationHadConversationId ) 
448448    { 
449449        // We're now going to need to augment the history with function result contents. 
450450        // That means we need a separate list to store the augmented history. 
451-         if  ( response . ChatThreadId  is  not null ) 
451+         if  ( response . ConversationId  is  not null ) 
452452        { 
453453            // The response indicates the inner client is tracking the history, so we don't want to send 
454454            // anything we've already sent or received. 
@@ -461,9 +461,9 @@ private static void FixupHistories(
461461                augmentedHistory  =  [ ] ; 
462462            } 
463463
464-             lastIterationHadThreadId  =  true ; 
464+             lastIterationHadConversationId  =  true ; 
465465        } 
466-         else  if  ( lastIterationHadThreadId ) 
466+         else  if  ( lastIterationHadConversationId ) 
467467        { 
468468            // In the very rare case where the inner client returned a response with a thread ID but then 
469469            // returned a subsequent response without one, we want to reconstitue the full history. To do that, 
@@ -474,7 +474,7 @@ private static void FixupHistories(
474474            augmentedHistory . AddRange ( originalMessages ) ; 
475475            augmentedHistory . AddRange ( allTurnsResponseMessages ) ; 
476476
477-             lastIterationHadThreadId  =  false ; 
477+             lastIterationHadConversationId  =  false ; 
478478        } 
479479        else 
480480        { 
@@ -486,7 +486,7 @@ private static void FixupHistories(
486486            // Now add the most recent response messages. 
487487            augmentedHistory . AddMessages ( response ) ; 
488488
489-             lastIterationHadThreadId  =  false ; 
489+             lastIterationHadConversationId  =  false ; 
490490        } 
491491
492492        // Use the augmented history as the new set of messages to send. 
@@ -525,22 +525,22 @@ private static bool CopyFunctionCalls(
525525        return  any ; 
526526    } 
527527
528-     private  static   void  UpdateOptionsForNextIteration ( ref  ChatOptions  options ,  string ?  chatThreadId ) 
528+     private  static   void  UpdateOptionsForNextIteration ( ref  ChatOptions  options ,  string ?  conversationId ) 
529529    { 
530530        if  ( options . ToolMode  is  RequiredChatToolMode ) 
531531        { 
532532            // We have to reset the tool mode to be non-required after the first iteration, 
533533            // as otherwise we'll be in an infinite loop. 
534534            options  =  options . Clone ( ) ; 
535535            options . ToolMode  =  null ; 
536-             options . ChatThreadId  =  chatThreadId ; 
536+             options . ConversationId  =  conversationId ; 
537537        } 
538-         else  if  ( options . ChatThreadId  !=  chatThreadId ) 
538+         else  if  ( options . ConversationId  !=  conversationId ) 
539539        { 
540540            // As with the other modes, ensure we've propagated the chat thread ID to the options. 
541541            // We only need to clone the options if we're actually mutating it. 
542542            options  =  options . Clone ( ) ; 
543-             options . ChatThreadId  =  chatThreadId ; 
543+             options . ConversationId  =  conversationId ; 
544544        } 
545545    } 
546546
0 commit comments