ParisNeo / ollama_proxy_server

A proxy server for multiple ollama instances with Key security
Apache License 2.0
249 stars 36 forks source link

More verbose errors/logs? #14

Closed MarcoMeter closed 2 months ago

MarcoMeter commented 2 months ago

Hi! Thanks for making this available!

I'm currently debugging this issue: curl: (52) Empty reply from server, which is the response from running the example: curl -X POST -H "Authorization: Bearer user1:key1" http://my_hostname:8080/api/generate --data '{'model':'gemma2,'prompt': "Once apon a time,","stream":false,"temperature": 0.3,"max_tokens": 1024}'

This is what's logged by the ollama-proxy-server:

[23/Jul/2024 16:47:19] "POST /api/generate HTTP/1.1" - -

When checking the logs of the ollama container, there is no incoming traffic. Originally, I had this working and then it stopped working. Sometimes it only worked from the same server and not from any other machine on WAN. So I fiddled around with binding the ip addresses of the ollama container and adapting the proxy's config.ini.

How could I get a more expressive log of the ollama-proxy-server to get more information to debug this?

MarcoMeter commented 2 months ago

I finally looked in to the accesss_log.txt. This is the output if I sent a request from a machine, which is not the host of the proxy.

2024-07-24 06:45:13.243516,gen_request,user,129.217.38.17,Authorized,DefaultServer,0,
2024-07-24 06:45:13.243674,gen_error,user,129.217.38.17,Authorized,DefaultServer,1,Expecting value: line 1 column 1 (char 0)
2024-07-24 06:45:13.243728,gen_done,user,129.217.38.17,Authorized,DefaultServer,0,
MarcoMeter commented 2 months ago

I finally resolved this. The example command

curl -X POST -H "Authorization: Bearer user1:key1" http://localhost:8080/api/generate --data '{'model':'mixtral:latest,'prompt': "Once apon a time,","stream":false,"temperature": 0.3,"max_tokens": 1024}'

can be successfully sent from bash, while it needs to be formatted differently when sending it form windows' command line.