Comments (14)
This "Hack" would probably just be pulled into the code :)
I'll try to get to it today
from openai.
Inside my local pub cache for the moment. It's in file called message.dart, but just click on the definition of RequestFunctionMessage and it will take you there.
from openai.
Gotcha, I can confirm changing to below like in your code it now works.
@override
Map<String, dynamic> toMap() {
return {
"role": role.name,
"content": content?.map((toolCall) => toolCall.toMap()).toList(),
"tool_call_id": toolCallId,
};
}
I look forward to fix in the next release.
Thanks!
from openai.
I released version 5.0.0 with the fix and some other changes:
Until you can confirm that the issue is fixed 100%, this issue will stay open.
from openai.
Found the cause - content was naivly encoded. This code works for me:
@override
Map<String, dynamic> toMap() {
return {
...super.toMap(),
"tool_call_id": toolCallId,
};
// return {
// "role": role.name,
// "content": content?.map((contentItem) => contentItem.toMap()).toList(),
// "tool_call_id": toolCallId,
// };
}
from openai.
@odedsolutions I got the exact same issue. Where did you add that code for the toMap override?
from openai.
but now where i can add this to fix this issue?
from openai.
For me on Ubuntu its in pub cache here:
~/.pub-cache/hosted/pub.dev/dart_openai-4.1.4/lib/src/core/models/chat/sub_models/choices/sub_models/message.dart at the end of file line 140 replace toMap with the fixed toMap code.
But hopefully there will be a fix soon in the next version and this "hack" should not be needed.
from openai.
@anasfik let me know if you want me to do it. (not sure how honestly 😅)
from openai.
I appreciate the effort here, Thank you for notifying me about this.
I will check this right now.
@odedsolutions no worries, I will handle it and inform you about it.
from openai.
Yes, very precise on this, thank you!
I will release
from openai.
Great, thanks @anasfik! Appreciate your work. I'll try the new release during this week and confirm.
from openai.
Awesome! I upgraded to the latest version 5.0.0 and I can confirm the fix works, thanks!
from openai.
Working for me too on 5.0.0. Thanks!
from openai.
Related Issues (20)
- Use Assistant API and other beta features HOT 2
- Breaking changes should be listed in the CHANGELOG 🙏 HOT 4
- Is there any complete example with the stream? HOT 3
- OpenAI.requestsTimeOut not working? HOT 1
- "name" field is missing in chat message HOT 1
- postAndExpectFileResponse with chunk support for real time audio streaming HOT 2
- Unhandled Exception: NoSuchMethodError: Class 'String' has no instance getter 'value'. HOT 7
- [question] Is it safe to use this package on release? HOT 4
- The argument type 'String' can't be assigned to the parameter type 'List<OpenAIChatCompletionChoiceMessageContentItemModel>?'. HOT 2
- My customized openai server can not load request any more: INFO: 127.0.0.1:51614 - "POST /v1/chat/completions HTTP/1.1" 422 Unprocessable Entity HOT 1
- [Transcription] Bad state: Stream has already been listened to HOT 7
- Offline Support HOT 2
- Support Azure OpenAI. HOT 4
- Collection dependency to 1.17.1 for flutter_test HOT 1
- Http errors are not sent to the stream as errors? HOT 1
- Failed host lookup: 'api.openai.com' HOT 1
- Got an exception when run on web
- Chat completion endpoint does not accept an array of strings in a system message HOT 1
- imageUrl Doesn't Work HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openai.