You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, and thanks a lot for the cool and well working bridge!
I'm testing using it to run https://github.com/opensouls/SocialAGI in our Python written backend. I ported the beginning of one of their examples and it actually works, using OpenAI's API for GPT, which is great.
However, I encountered a problem when trying to pass Python defined message objects for the JS lib. They are very simple objects with just two strings as params, role and content. The problem is that the bridge adds the ffid param to the object as well, and that apparently then gets included in the json which the js lib sends to the OpenAI API, which then rejects the request:
[JSE] error: {
[JSE] message: "Additional properties are not allowed ('ffid' was unexpected) - 'messages.0'",
Would it be possible to somehow hide the ffid param from the foreign objects, to avoid such problems? I don't know if there is some technique in JS that would allow it. In Python, objects have ids, so it would be possible to have a map using those, but JS objs don't have ids so that's hard?
I can deal with this by making such JS helper funcs, but figured to note about the issue anyway, and it would be nice to get it fixed. I was thinking that could use https://pypi.org/project/ts2python/ to generate py(dantic) types from the typescript lib later on, to get nice support for creating such messages and other objs that the lib has interfaces for.
Oh and ofc another way to fix this would be to hack the SocialAGI lib to strip out the ffid param, or make the json serialization with those types somehow smarter there, I did not look in that direction (yet).
The text was updated successfully, but these errors were encountered:
antont
changed the title
The FFID param in a Python object that's passed to OpenAI's client lib and API causes an error
The FFID attribute in a Python object that's passed to OpenAI's client lib and API causes an error
Feb 1, 2024
Hi, and thanks a lot for the cool and well working bridge!
I'm testing using it to run https://github.com/opensouls/SocialAGI in our Python written backend. I ported the beginning of one of their examples and it actually works, using OpenAI's API for GPT, which is great.
However, I encountered a problem when trying to pass Python defined message objects for the JS lib. They are very simple objects with just two strings as params,
role
andcontent
. The problem is that the bridge adds theffid
param to the object as well, and that apparently then gets included in the json which the js lib sends to the OpenAI API, which then rejects the request:Would it be possible to somehow hide the ffid param from the foreign objects, to avoid such problems? I don't know if there is some technique in JS that would allow it. In Python, objects have ids, so it would be possible to have a map using those, but JS objs don't have ids so that's hard?
This is the code that fails with the above error:
Luckily, this problem is possible to work-around by creating the message object in js, so i made a little helper library which has:
And then this works:
To fix the problem in the earlier version.
I can deal with this by making such JS helper funcs, but figured to note about the issue anyway, and it would be nice to get it fixed. I was thinking that could use https://pypi.org/project/ts2python/ to generate py(dantic) types from the typescript lib later on, to get nice support for creating such messages and other objs that the lib has interfaces for.
Oh and ofc another way to fix this would be to hack the SocialAGI lib to strip out the
ffid
param, or make the json serialization with those types somehow smarter there, I did not look in that direction (yet).The text was updated successfully, but these errors were encountered: