eino icon indicating copy to clipboard operation
eino copied to clipboard

ToOpenAPIV3() return both nil openapi3.Schema and nil error

Open cruvie opened this issue 9 months ago • 7 comments

Describe the bug

GOROOT=/Users/cruvie/go/pkg/mod/golang.org/[email protected] #gosetup
GOPATH=/Users/cruvie/go #gosetup
/Users/cruvie/go/pkg/mod/golang.org/[email protected]/bin/go build -o /Users/cruvie/Library/Caches/JetBrains/IntelliJIdea2024.3/tmp/GoLand/___1go_build_github_com_cloudwego_eino_examples_cmk_kkRAG_main -gcflags all=-N -l github.com/cloudwego/eino-examples/cmk/kkRAG/main #gosetup
"/Users/cruvie/Library/Application Support/JetBrains/IntelliJIdea2024.3/plugins/go-plugin/lib/dlv/macarm/dlv" --listen=127.0.0.1:52507 --headless=true --api-version=2 --check-go-version=false --only-same-user=false exec /Users/cruvie/Library/Caches/JetBrains/IntelliJIdea2024.3/tmp/GoLand/___1go_build_github_com_cloudwego_eino_examples_cmk_kkRAG_main -- #gosetup
API server listening at: 127.0.0.1:52507
panic: failed to wait for tasks: execute node[Lambda5] fail: failed to wait for tasks: execute node[chat] fail: panic error: runtime error: invalid memory address or nil pointer dereference, 
	stack: goroutine 1 [running]:
	runtime/debug.Stack()
		/Users/cruvie/go/pkg/mod/golang.org/[email protected]/src/runtime/debug/stack.go:26 +0x64
	github.com/cloudwego/eino/compose.(*taskManager).executor.func1()
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/compose/graph_manager.go:225 +0x80
	panic({0x10351bf80?, 0x103a11350?})
		/Users/cruvie/go/pkg/mod/golang.org/[email protected]/src/runtime/panic.go:785 +0xf0
	github.com/cloudwego/eino-ext/components/model/ollama.toOllamaTools({0x14000062418, 0x1, 0x1})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/eino-ext/components/model/[email protected]/chatmodel.go:384 +0x128
	github.com/cloudwego/eino-ext/components/model/ollama.(*ChatModel).genRequest(0x140001992c0, {0x103608110, 0x14000098720}, 0x0, {0x1400009a190, 0x2, 0x2}, {0x0, 0x0, 0x0})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/eino-ext/components/model/[email protected]/chatmodel.go:267 +0x9cc
	github.com/cloudwego/eino-ext/components/model/ollama.(*ChatModel).Generate(0x140001992c0, {0x103608110, 0x14000098720}, {0x1400009a190, 0x2, 0x2}, {0x0, 0x0, 0x0})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/eino-ext/components/model/[email protected]/chatmodel.go:103 +0x134
	github.com/cloudwego/eino/compose.(*runnablePacker[...]).Invoke(0x10361c080, {0x103608110, 0x14000098720}, {0x1400009a190, 0x2, 0x2}, {0x0, 0x0, 0x0})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/compose/runnable.go:223 +0x88
	github.com/cloudwego/eino/compose.(*runnablePacker[...]).toComposableRunnable.func4({0x1034cc8c0, 0x140000a6060}, {0x0, 0x0, 0x0})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/compose/runnable.go:192 +0x204
	github.com/cloudwego/eino/compose.runnableInvoke({0x103608110, 0x14000098720}, 0x14000154b80, {0x1034cc8c0, 0x140000a6060}, {0x0, 0x0, 0x0})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/compose/graph_run.go:112 +0x7c
	github.com/cloudwego/eino/compose.(*taskManager).executor(0x140000a0050, 0x1400009c2a0)
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/compose/graph_manager.go:234 +0x1fc
	github.com/cloudwego/eino/compose.(*taskManager).submit(0x140000a0050, {0x1400009e050, 0x0, 0x0})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/compose/graph_manager.go:261 +0x538
	github.com/cloudwego/eino/compose.(*runner).run(0x14000001440, {0x103608110, 0x140000985d0}, 0x0, {0x1034cc8c0, 0x140000a6048}, {0x0, 0x0, 0x0})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/compose/graph_run.go:201 +0xaf0
	github.com/cloudwego/eino/compose.(*runner).invoke(0x14000001440, {0x103608110, 0x140000984e0}, {0x1034cc8c0, 0x140000a6048}, {0x0, 0x0, 0x0})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/compose/graph_run.go:97 +0x74
	github.com/cloudwego/eino/compose.(*runner).toComposableRunnable.func1({0x103608110, 0x140000984e0}, {0x1034cc8c0, 0x140000a6048}, {0x103a4b3a0, 0x0, 0x0})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/compose/graph_run.go:383 +0x128
	github.com/cloudwego/eino/compose.runWithCallbacks[...].func1({0x1034cc8c0, 0x140000a6048}, {0x103a4b3a0, 0x0, 0x0})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/compose/utils.go:168 +0x110
	github.com/cloudwego/eino/compose.toGenericRunnable[...].func1({0x140000a6018, 0x2, 0x3}, {0x0, 0x0, 0x0})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/compose/runnable.go:527 +0xdc
	github.com/cloudwego/eino/compose.(*runnablePacker[...]).wrapRunnableCtx.func1({0x140000a6018, 0x2, 0x3}, {0x0, 0x0, 0x0})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/compose/runnable.go:99 +0xb8
	github.com/cloudwego/eino/compose.(*runnablePacker[...]).Invoke(0x10361b900, {0x103608110, 0x14000098480}, {0x140000a6018, 0x2, 0x3}, {0x0, 0x0, 0x0})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/compose/runnable.go:223 +0x88
	github.com/cloudwego/eino/flow/agent/react.(*Agent).Generate(0x140001998f0, {0x103608110, 0x14000098480}, {0x140000a6018, 0x2, 0x3}, {0x0, 0x0, 0x0})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/flow/agent/react/react.go:310 +0xc4
	github.com/cloudwego/eino/compose.runWithCallbacks[...].func1({0x140000a6018, 0x2, 0x3}, {0x0, 0x0, 0x0})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/compose/utils.go:168 +0x134
	github.com/cloudwego/eino/compose.(*runnablePacker[...]).Invoke(0x10361b720, {0x103608110, 0x14000098480}, {0x140000a6018, 0x2, 0x3}, {0x0, 0x0, 0x0})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/compose/runnable.go:223 +0x88
	github.com/cloudwego/eino/compose.(*runnablePacker[...]).toComposableRunnable.func4({0x1034cc8c0, 0x140000a6030}, {0x0, 0x0, 0x0})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/compose/runnable.go:192 +0x204
	github.com/cloudwego/eino/compose.runnableInvoke({0x103608110, 0x14000098480}, 0x14000154e00, {0x1034cc8c0, 0x140000a6030}, {0x0, 0x0, 0x0})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/compose/graph_run.go:112 +0x7c
	github.com/cloudwego/eino/compose.(*taskManager).executor(0x140000a0000, 0x1400009c150)
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/compose/graph_manager.go:234 +0x1fc
	github.com/cloudwego/eino/compose.(*taskManager).submit(0x140000a0000, {0x1400009e030, 0x0, 0x0})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/compose/graph_manager.go:261 +0x538
	github.com/cloudwego/eino/compose.(*runner).run(0x14000001560, {0x103608110, 0x14000098030}, 0x0, {0x1035124e0, 0x14000199bc0}, {0x0, 0x0, 0x0})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/compose/graph_run.go:201 +0xaf0
	github.com/cloudwego/eino/compose.(*runner).invoke(0x14000001560, {0x103608110, 0x14000098030}, {0x1035124e0, 0x14000199bc0}, {0x0, 0x0, 0x0})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/compose/graph_run.go:97 +0x74
	github.com/cloudwego/eino/compose.(*runner).toComposableRunnable.func1({0x103608110, 0x14000098030}, {0x1035124e0, 0x14000199bc0}, {0x103a4b3a0, 0x0, 0x0})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/compose/graph_run.go:383 +0x128
	github.com/cloudwego/eino/compose.runWithCallbacks[...].func1({0x1035124e0, 0x14000199bc0}, {0x103a4b3a0, 0x0, 0x0})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/compose/utils.go:168 +0x110
	github.com/cloudwego/eino/compose.toGenericRunnable[...].func1({0x1035124e0, 0x14000199bc0}, {0x0, 0x0, 0x0})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/compose/runnable.go:527 +0xbc
	github.com/cloudwego/eino/compose.(*runnablePacker[...]).wrapRunnableCtx.func1({0x1035124e0, 0x14000199bc0}, {0x0, 0x0, 0x0})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/compose/runnable.go:99 +0xb0
	github.com/cloudwego/eino/compose.(*runnablePacker[...]).Invoke(0x10361b360, {0x1036081f0, 0x103a4b3a0}, {0x1035124e0, 0x14000199bc0}, {0x0, 0x0, 0x0})
		/Users/cruvie/go/pkg/mod/github.com/cloudwego/[email protected]/compose/runnable.go:223 +0x80
	main.main()
		/Users/cruvie/cruvie-space/code-hub/open-source/eino-examples/cmk/kkRAG/main/main.go:15 +0x1d8
	

goroutine 1 [running]:
main.main()
	/Users/cruvie/cruvie-space/code-hub/open-source/eino-examples/cmk/kkRAG/main/main.go:20 +0x2e4

调试器 已完成,退出代码为 0

To Reproduce

Steps to reproduce the behavior:

  1. run main.go

kkRAG.zip

Expected behavior

run with no error

Screenshots

Image

Version:

0.3.14

Environment:

AR='ar'
CC='clang'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='clang++'
GCCGO='gccgo'
GO111MODULE='on'
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/Users/cruvie/Library/Caches/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/Users/cruvie/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/zc/n4bjshb57n9cmlp4nn3ljg800000gp/T/go-build2658195621=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE='actiontech.cloud'
GOMOD='/Users/cruvie/cruvie-space/code-hub/open-source/eino-examples/go.mod'
GOMODCACHE='/Users/cruvie/go/pkg/mod'
GONOPROXY='gitee.com/cruvie,actiontech.cloud'
GONOSUMDB='gitee.com/cruvie,actiontech.cloud'
GOOS='darwin'
GOPATH='/Users/cruvie/go'
GOPRIVATE='gitee.com/cruvie,actiontech.cloud'
GOPROXY='https://goproxy.cn,direct'
GOROOT='/Users/cruvie/go/go1.24.0'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/cruvie/Library/Application Support/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/cruvie/go/go1.24.0/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.24.0'
GOWORK=''
PKG_CONFIG='pkg-config'

Additional context

I think it is a bug and I made a pr to fix this. https://github.com/cloudwego/eino/blob/93cb521266bf9420d5df16aa0d378408a7449c95/schema/tool.go#L117

cruvie avatar Mar 02 '25 08:03 cruvie

This is an intended behavior. We probably won't change this because certain model will not accept a zero valued &OpenAPIV3{}. We will fix the ollama chatmodel implementation to account for this.

shentongmartin avatar Mar 03 '25 03:03 shentongmartin

Image 在0.3.14版本中也遇到OpenAPI3.Types的问题,不知是否因为我的openai3的版本问题,还是因为我的eino版本有问题。 Image

wang2222qq avatar Mar 10 '25 12:03 wang2222qq

openapi3 依赖库的版本问题,看下 eino 的 readme 里有说明

shentongmartin avatar Mar 11 '25 00:03 shentongmartin

嗯,好的。已更新了openapi3的版本,正常解决了。

wang2222qq avatar Mar 11 '25 03:03 wang2222qq

@hi-pender why closed? I did't find a pr as @shentongmartin said above to fix this, and 0.3.15 did not solve this issue

cruvie avatar Mar 12 '25 16:03 cruvie

reopened. working on it.

shentongmartin avatar Mar 13 '25 04:03 shentongmartin

@cruvie sorry, i thought it's the same guy who said "problem solved".

i reopened this issue. and the problem will be solved by follow steps:

  1. all chat model implements will be added the assert of ToolInfo.ParamsOneOf == nil, and deal with empty properties one model by one model(different model have different way) Image

  2. this position in cloudwego/eino will return an error -- more in line with Go programming conventions

Image

hi-pender avatar Mar 13 '25 04:03 hi-pender