Dump A Dict to max, One / single element array dict bug solution
Hey I just wrote a patch that dumps a dict in max format, including any nested data. So if you are like me and just want to get everything out of any dict to max at once here is a solution in pure max without js.
Just send the patcher your dictionary name and it spits out the entire dictionary with nested data and arrays using max syntax.
print: prompt this is the 'end' of the world and it is now the beginning of time
print: temperature 0.0000
print: max_tokens 31
print: top_p 0.0000
print: frequency_penalty 0.0000
print: presence_penalty 0.0000
print: stop[0] .
print: stop[1] +
print: stop[2]
print: engine davinci
print: response::id cmpl-3xYpqH8fykcBKR1aViLQ7dQSWSiBc
print: response::object text_completion
print: response::created 1635324270
print: response::model davinci:2020-05-03
print: response::choices::text — about is very gorgeous
print: response::choices::index 0
print: response::choices::logprobs 0
print: response::choices::finish_reason length
print: tags test_2
this is super handy if you then dynamically use the forward object to distribute the data (also in the patch).
I found this really frustrating to make, especially as the gettype request does not distinguish between a dictionary and a one element array, so the work around is to reset one-element-arrays converting them to their content and removing the [] array symbols.
anyway, hope it helps someone!
Wow, really nice solution!
This kind of stuff always makes me quite surprised, as I'm in many cases unable to implement some algorithms in visual/data-flow way, so I'm using scripting or custom-made externals to accomplish this kind of tasks.
And when I see a ready-made solution, it seems natural to me...
Thanks Yaniki!
As someone who mostly works in visual programming the dict object is quite aloof, and the documentation is quite scarce so i am hoping this adds some info to those like me.
:)
Perfect! This instantly fixes more things than I thought I needed. Thanks!