File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { ConfigurationError } from "@pipedream/platform";
66export default {
77 ...common ,
88 name : "Chat" ,
9- version : "0.2.8 " ,
9+ version : "0.2.9 " ,
1010 key : "openai-chat" ,
1111 description : "The Chat API, using the `gpt-3.5-turbo` or `gpt-4` model. [See the documentation](https://platform.openai.com/docs/api-reference/chat)" ,
1212 type : "action" ,
@@ -159,6 +159,16 @@ export default {
159159 } ,
160160 } ) ;
161161
162+ if ( this . responseFormat === constants . CHAT_RESPONSE_FORMAT . JSON_SCHEMA . value ) {
163+ for ( const choice of response . choices ) {
164+ try {
165+ choice . message . content = JSON . parse ( choice . message . content ) ;
166+ } catch {
167+ console . log ( `Unable to parse JSON: ${ choice . message . content } ` ) ;
168+ }
169+ }
170+ }
171+
162172 if ( response ) {
163173 $ . export ( "$summary" , `Successfully sent chat with id ${ response . id } ` ) ;
164174 }
Original file line number Diff line number Diff line change 11{
22 "name" : " @pipedream/openai" ,
3- "version" : " 0.10.0 " ,
3+ "version" : " 0.10.1 " ,
44 "description" : " Pipedream OpenAI Components" ,
55 "main" : " openai.app.mjs" ,
66 "keywords" : [
You can’t perform that action at this time.
0 commit comments