It has been a while for me to post a question but here is my latest headscratcher when using tsNetGetSync.
I hope that someone has an answer for me .
I have locally set up an opensource AI named LocalAI in Docker which works.
I now try to cummunicate with it using tsNetGetSync.
For getting the installed models according to LocalAI documentation i need to use the following curl command.
Code: Select all
curl http://localhost:8080/v1/models
Code: Select all
put "" into tHeaders
put "http://localhost:8080/v1/models" into tBaseURL
put tsNetGetSync(tBaseURL, tHeaders, tRecvHeaders, tResult, tBytes) into tData
However the next step where I ask the AI 'How are you?' i cannot get to work.
Below is the original curl request example from the site .
Code: Select all
curl http://localhost:8080/v1/chat/completions -H "Content-Type: application/json" -d '{
"model": "luna-ai-llama2",
"messages": [{"role": "user", "content": "How are you?"}],
"temperature": 0.9
}'
------.
I do know that putting the header variable in alphabetical order is important for tsNetGetSync.
I tried multiple setups for the tRequest string but no luck. (Keep getting error 404).
Regards,
MrCoolLion (Paul)
Code: Select all
put "http://localhost:8080" into tBaseURL
put "" into tHeaders
//put "/v1/chat/completions&Content-Type: application/json & model: ggml-gpt4all-j & messages: [&role: user&content: How are you?&] & temperature: 0.9" into tHeaders
//put "/v1/chat/completions&content:How are you?&Content-Type:application/json&model:ggml-gpt4all-j&role:user&temperature:0.9" into tHeaders
put "/v1/chat/completions&Content-Type: application/json & model: ggml-gpt4all-j & messages: [&role: user&content: How are you?&] & temperature: 0.9" into tHeaders
put tBaseURL&tHeaders into tRequestString
put "" into tHeaders
put tsNetGetSync(tRequestString, tHeaders, tRecvHeaders, tResult, tBytes) into tData