Problem with the shell command with a local server

Bob Sneidar bobsneidar at iotecdigital.com
Mon Dec 30 12:11:25 EST 2024


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




More information about the use-livecode mailing list