File tree Expand file tree Collapse file tree 1 file changed +7
-13
lines changed
conversation/csharp/http/conversation Expand file tree Collapse file tree 1 file changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,6 @@ limitations under the License.
3030
3131var conversationRequestBody = JsonSerializer . Deserialize < Dictionary < string , object ? > > ( """
3232 {
33- "name": "echo",
3433 "inputs": [{
3534 "messages": [{
3635 "of_user": {
@@ -67,7 +66,6 @@ limitations under the License.
6766
6867var toolCallRequestBody = JsonSerializer . Deserialize < Dictionary < string , object ? > > ( """
6968 {
70- "name": "demo",
7169 "inputs": [
7270 {
7371 "messages": [
@@ -135,24 +133,20 @@ limitations under the License.
135133var toolCallingResponse = await httpClient . PostAsJsonAsync ( "http://localhost:3500/v1.0-alpha2/conversation/echo/converse" , toolCallRequestBody ) ;
136134var toolCallingResult = await toolCallingResponse . Content . ReadFromJsonAsync < JsonElement > ( ) ;
137135
138- var toolCallingContent = toolCallingResult
136+ var messageElement = toolCallingResult
139137 . GetProperty ( "outputs" )
140138 . EnumerateArray ( )
141139 . First ( )
142140 . GetProperty ( "choices" )
143141 . EnumerateArray ( )
144142 . First ( )
145- . GetProperty ( "message" )
146- . GetProperty ( "content" ) ;
143+ . GetProperty ( "message" ) ;
147144
148- var functionCalled = toolCallingResult
149- . GetProperty ( "outputs" )
150- . EnumerateArray ( )
151- . First ( )
152- . GetProperty ( "choices" )
153- . EnumerateArray ( )
154- . First ( )
155- . GetProperty ( "message" )
145+ var toolCallingContent = messageElement . TryGetProperty ( "content" , out var contentElement )
146+ ? contentElement . GetString ( )
147+ : null ;
148+
149+ var functionCalled = messageElement
156150 . GetProperty ( "toolCalls" )
157151 . EnumerateArray ( )
158152 . First ( )
You can’t perform that action at this time.
0 commit comments