Problem with the shell command with a local server
jbv at souslelogo.com
jbv at souslelogo.com
Mon Dec 30 12:40:26 EST 2024
Actually it's not so simple, as the line is randomly corrupted and
almost doesn't look twice the same.
I already tried to clean up the json before using JsonImport, but it's
almost impossible to use a general rule.
I would prefer to find a way to prevent this to happen, since it doesn't
happen in Terminal. So it looks like something specific to the shell
command
in LC.
For the record, I have tried with different models in LM Studio and the
problem is the same. However, I am using the same technique with the
OpenAI
API and I don't have the problem. So I suspect there is something
specific
happening when using the shell command with a local server.
Le 2024-12-30 12:11, Bob Sneidar via use-livecode a écrit :
> If you are parsing in LC, you can get the first word of each line. Now
> if the text returned actually contains a line break in the second line
> that is producing the erroneous third line, you may have to test the
> range of each line.
>
> Bob S
>
>> On Dec 30, 2024, at 8:13 AM, jbv via use-livecode
>> <use-livecode at lists.runrev.com> wrote:
>>
>> Hi list,
>>
>> Long story short : I am using LM Studio as a local server to send
>> requests to an LLM model.
>> I use the shell command in LC 9.6 with curl on MacOS Sequoia 15.1.1.
>>
>> The request looks like that :
>> curl http://127.0.0.1:1234/v1/embeddings \
>> -H "Content-Type: application/json" \
>> -d '{
>> "model": "text-embedding-granite-embedding-278m-multilingual",
>> "input": "some text"
>> }'
>>
>> The response is a json file with a list of vectors.
>> When I execute the command in Terminal, everything works fine.
>> But when I use "put shell(tcurl) into myjson" in a LC script,
>> I get the same result, except for a line that is inserted in the
>> middle of the json and looks like that :
>> ...
>> 0.01324639841914177,
>> 0.085932932794094
>> 100 23374 100 23264 100 110 873k 4227 --:--:-- --:--:--
>> --:--:-- 913k
>> 09,
>> -0.020998964086174965,
>> ...
>>
>> instead of
>> ...
>> 0.01324639841914177,
>> 0.08593293279409409,
>> -0.020998964086174965,
>> ...
>>
>> Because of that I can't parse the json and I get an error with
>> JsonImport.
>>
>> What am I doing wrong ?
>> How can I fix it ?
>>
>> Thank you in advance
>> jbv
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list