Closed realnoob007 closed 1 year ago
openai.api_base
should be http://localhost:3700/v1
Sorry. I still have the trouble. Would you like to provide a simple example to use this? I am sure I start the api successfully in docker.
I also test with curl http://localhost:3700/v1/chat/completions \
-H "Content-Type: application/json" \ -H "Authorization: Bearer 123" \ -d '{ "model": "gpt-3.5-turbo", "messages": [{"role": "user", "content": "Say this is a test!"}], }'
And it returned "bad request"
Could you please provide more details about the error you encountered? I would also like to see the complete output from both the Python and the Go sides.
emmm. I am running this project in docker. My OS is Ubuntu20.04. I actually tried several ways to check if the service is working. Through requests, curl, and openai python package, it all fails. All of the response shows status code 500. I am wondering which part causes the problem. I don't know if the code is wrong or my server's error.
Could you please share the full output from both the Python and the Go sides? You can try running the program without Docker.
Hi, I also got the same error once running this with docker composer this is output error from container
runtime error: invalid memory address or nil pointer dereference /usr/local/go/src/runtime/panic.go:260 (0x44b29c) panicmem: panic(memoryError) /usr/local/go/src/runtime/signal_unix.go:841 (0x44b26c) sigpanic: panicmem() /app/poe/poe.go:152 (0x7f9624) (*Client).Release: c.Lock = false /app/router/router.go:41 (0x7fb999) Setup.func2: return /go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x7d2d61) (*Context).Next: c.handlers[c.index](c) /go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/recovery.go:102 (0x7d2d4c) CustomRecoveryWithWriter.func1: c.Next() /go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x7d1e86) (*Context).Next: c.handlers[c.index](c) /go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/logger.go:240 (0x7d1e69) LoggerWithConfig.func1: c.Next() /go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 (0x7d0f0a) (*Context).Next: c.handlers[c.index](c) /go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/gin.go:620 (0x7d0b91) (*Engine).handleHTTPRequest: c.Next() /go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/gin.go:576 (0x7d083c) (*Engine).ServeHTTP: engine.handleHTTPRequest(c) /usr/local/go/src/net/http/server.go:2936 (0x65ea75) serverHandler.ServeHTTP: handler.ServeHTTP(rw, req) /usr/local/go/src/net/http/server.go:1995 (0x65b391) (*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req) /usr/local/go/src/runtime/asm_amd64.s:1598 (0x466f00) goexit: BYTE $0x90 // NOP
Hi, I found my issue happens if running with docker-compose because follow this instruction in config.example.toml
# Note that if you use docker this value should be changed into: http://external:5100 gateway = "http://localhost:5100"
I change the gateway value to http://poe-openai-proxy_external_1:5100 instead of http://external:5100. it solves my problem and the service can run well without error 500.
@kandangjamur Hi there, could you please send your test code so I can check if it can fix my problem? What did you set for the api_host?
@juzeon When I try to run "go build" without docker, here comes something wrong. I'm not quite familiar with golang and my go version is go1.19.2 linux/amd64:
/usr/local/go/src/runtime/stkframe.go:15:6: stkframe redeclared in this block /usr/local/go/src/runtime/runtime2.go:998:6: other declaration of stkframe /usr/local/go/src/runtime/stkframe.go:262:5: methodValueCallFrameObjs redeclared in this block /usr/local/go/src/runtime/stack.go:1362:5: other declaration of methodValueCallFrameObjs /usr/local/go/src/runtime/stkframe.go:264:6: stkobjinit redeclared in this block /usr/local/go/src/runtime/stack.go:1364:6: other declaration of stkobjinit /usr/local/go/src/runtime/traceback.go:670:6: reflectMethodValue redeclared in this block /usr/local/go/src/runtime/stkframe.go:65:6: other declaration of reflectMethodValue /usr/local/go/src/runtime/unsafe.go:53:6: unsafeslice redeclared in this block /usr/local/go/src/runtime/slice.go:127:6: other declaration of unsafeslice /usr/local/go/src/runtime/unsafe.go:74:6: unsafeslice64 redeclared in this block /usr/local/go/src/runtime/slice.go:142:6: other declaration of unsafeslice64 /usr/local/go/src/runtime/unsafe.go:82:6: unsafeslicecheckptr redeclared in this block /usr/local/go/src/runtime/slice.go:150:6: other declaration of unsafeslicecheckptr /usr/local/go/src/runtime/unsafe.go:92:6: panicunsafeslicelen redeclared in this block /usr/local/go/src/runtime/slice.go:160:6: other declaration of panicunsafeslicelen /usr/local/go/src/runtime/unsafe.go:96:6: panicunsafeslicenilptr redeclared in this block /usr/local/go/src/runtime/slice.go:164:6: other declaration of panicunsafeslicenilptr /usr/local/go/src/runtime/arena.go:157:26: span.isUserArenaChunk undefined (type *mspan has no field or method isUserArenaChunk) /usr/local/go/src/runtime/arena.go:157:26: too many errors
@juzeon When I try to run "go build" without docker, here comes something wrong. I'm not quite familiar with golang and my go version is go1.19.2 linux/amd64:
runtime
/usr/local/go/src/runtime/stkframe.go:15:6: stkframe redeclared in this block /usr/local/go/src/runtime/runtime2.go:998:6: other declaration of stkframe /usr/local/go/src/runtime/stkframe.go:262:5: methodValueCallFrameObjs redeclared in this block /usr/local/go/src/runtime/stack.go:1362:5: other declaration of methodValueCallFrameObjs /usr/local/go/src/runtime/stkframe.go:264:6: stkobjinit redeclared in this block /usr/local/go/src/runtime/stack.go:1364:6: other declaration of stkobjinit /usr/local/go/src/runtime/traceback.go:670:6: reflectMethodValue redeclared in this block /usr/local/go/src/runtime/stkframe.go:65:6: other declaration of reflectMethodValue /usr/local/go/src/runtime/unsafe.go:53:6: unsafeslice redeclared in this block /usr/local/go/src/runtime/slice.go:127:6: other declaration of unsafeslice /usr/local/go/src/runtime/unsafe.go:74:6: unsafeslice64 redeclared in this block /usr/local/go/src/runtime/slice.go:142:6: other declaration of unsafeslice64 /usr/local/go/src/runtime/unsafe.go:82:6: unsafeslicecheckptr redeclared in this block /usr/local/go/src/runtime/slice.go:150:6: other declaration of unsafeslicecheckptr /usr/local/go/src/runtime/unsafe.go:92:6: panicunsafeslicelen redeclared in this block /usr/local/go/src/runtime/slice.go:160:6: other declaration of panicunsafeslicelen /usr/local/go/src/runtime/unsafe.go:96:6: panicunsafeslicenilptr redeclared in this block /usr/local/go/src/runtime/slice.go:164:6: other declaration of panicunsafeslicenilptr /usr/local/go/src/runtime/arena.go:157:26: span.isUserArenaChunk undefined (type *mspan has no field or method isUserArenaChunk) /usr/local/go/src/runtime/arena.go:157:26: too many errors
Please try running go mod tidy
before running go build
.
go mod tidy
Unfortunately, it doesn't change anything. The output is the same
It seems that your Go environment is corrupted. You might have to reinstall Go. Check out: https://stackoverflow.com/questions/62330084/fail-to-build-with-code-go-redeclared-in-this-block.
It seems that your Go environment is corrupted. You might have to reinstall Go. Check out: https://stackoverflow.com/questions/62330084/fail-to-build-with-code-go-redeclared-in-this-block.
Thanks for your patience very much. I successufly run this wonderful project now! It seems to have some problems with docker. It works well in terminal,
import openai openai.api_key = "123" openai.api_base="http://localhost:3700" openai.ChatCompletion.create( ... model="gpt-3.5-turbo", ... messages=[ ... {"role": "system", "content": "You are a helpful assistant."}, ... {"role": "user", "content": "Who won the world series in 2020?"}, ... {"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."}, ... {"role": "user", "content": "Where was it played?"} ... ] ... )
报错: Traceback (most recent call last): File "/usr/local/lib/python3.11/dist-packages/openai/api_requestor.py", line 403, in handle_error_response error_data = resp["error"]