Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: move utils to internal #76

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/tool/utils/invokable_func.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (
"github.com/getkin/kin-openapi/openapi3gen"

"github.com/cloudwego/eino/components/tool"
"github.com/cloudwego/eino/internal/generic"
"github.com/cloudwego/eino/schema"
"github.com/cloudwego/eino/utils/generic"
)

// InvokeFunc is the function type for the tool.
Expand Down
2 changes: 1 addition & 1 deletion components/tool/utils/streamable_func.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
"github.com/bytedance/sonic"

"github.com/cloudwego/eino/components/tool"
"github.com/cloudwego/eino/internal/generic"
"github.com/cloudwego/eino/schema"
"github.com/cloudwego/eino/utils/generic"
)

// StreamFunc is the function type for the streamable tool.
Expand Down
2 changes: 1 addition & 1 deletion compose/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import (
"github.com/cloudwego/eino/components/model"
"github.com/cloudwego/eino/components/prompt"
"github.com/cloudwego/eino/components/retriever"
"github.com/cloudwego/eino/internal/generic"
"github.com/cloudwego/eino/internal/gmap"
"github.com/cloudwego/eino/internal/gslice"
"github.com/cloudwego/eino/schema"
"github.com/cloudwego/eino/utils/generic"
)

// NewChain create a chain with input/output type.
Expand Down
2 changes: 1 addition & 1 deletion compose/chain_branch.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import (
"github.com/cloudwego/eino/components/model"
"github.com/cloudwego/eino/components/prompt"
"github.com/cloudwego/eino/components/retriever"
"github.com/cloudwego/eino/internal/generic"
"github.com/cloudwego/eino/schema"
"github.com/cloudwego/eino/utils/generic"
)

type nodeOptionsPair generic.Pair[*graphNode, *graphAddNodeOpts]
Expand Down
4 changes: 2 additions & 2 deletions compose/field_mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import (
"runtime/debug"
"strings"

"github.com/cloudwego/eino/internal/generic"
"github.com/cloudwego/eino/internal/safe"
"github.com/cloudwego/eino/schema"
"github.com/cloudwego/eino/utils/generic"
"github.com/cloudwego/eino/utils/safe"
)

type FieldMapping struct {
Expand Down
2 changes: 1 addition & 1 deletion compose/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ import (
"github.com/cloudwego/eino/components/model"
"github.com/cloudwego/eino/components/prompt"
"github.com/cloudwego/eino/components/retriever"
"github.com/cloudwego/eino/internal/generic"
"github.com/cloudwego/eino/internal/gmap"
"github.com/cloudwego/eino/schema"
"github.com/cloudwego/eino/utils/generic"
)

// START is the start node of the graph. You can add your first edge with START.
Expand Down
2 changes: 1 addition & 1 deletion compose/graph_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"runtime/debug"
"sync"

"github.com/cloudwego/eino/utils/safe"
"github.com/cloudwego/eino/internal/safe"
)

type channel interface {
Expand Down
2 changes: 1 addition & 1 deletion compose/graph_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"reflect"

"github.com/cloudwego/eino/components"
"github.com/cloudwego/eino/utils/generic"
"github.com/cloudwego/eino/internal/generic"
)

// the info of most original executable object directly provided by the user
Expand Down
2 changes: 1 addition & 1 deletion compose/runnable.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"fmt"
"reflect"

"github.com/cloudwego/eino/internal/generic"
"github.com/cloudwego/eino/schema"
"github.com/cloudwego/eino/utils/generic"
)

// Runnable is the interface for an executable object. Graph, Chain can be compiled into Runnable.
Expand Down
2 changes: 1 addition & 1 deletion compose/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"reflect"
"sync"

"github.com/cloudwego/eino/internal/generic"
"github.com/cloudwego/eino/schema"
"github.com/cloudwego/eino/utils/generic"
)

// GenLocalState is a function that generates the state.
Expand Down
2 changes: 1 addition & 1 deletion compose/stream_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package compose
import (
"reflect"

"github.com/cloudwego/eino/internal/generic"
"github.com/cloudwego/eino/schema"
"github.com/cloudwego/eino/utils/generic"
)

type streamReader interface {
Expand Down
2 changes: 1 addition & 1 deletion compose/tool_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import (
"github.com/cloudwego/eino/callbacks"
"github.com/cloudwego/eino/components"
"github.com/cloudwego/eino/components/tool"
"github.com/cloudwego/eino/internal/safe"
"github.com/cloudwego/eino/schema"
"github.com/cloudwego/eino/utils/safe"
)

type toolsNodeOptions struct {
Expand Down
2 changes: 1 addition & 1 deletion compose/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (

"github.com/cloudwego/eino/callbacks"
icb "github.com/cloudwego/eino/internal/callbacks"
"github.com/cloudwego/eino/internal/generic"
"github.com/cloudwego/eino/schema"
"github.com/cloudwego/eino/utils/generic"
)

func mergeMap(vs []any) (any, error) {
Expand Down
2 changes: 1 addition & 1 deletion compose/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (

"github.com/stretchr/testify/assert"

"github.com/cloudwego/eino/internal/generic"
"github.com/cloudwego/eino/schema"
"github.com/cloudwego/eino/utils/generic"
)

func TestMergeValues(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion compose/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/cloudwego/eino/components/model"
"github.com/cloudwego/eino/components/prompt"
"github.com/cloudwego/eino/components/retriever"
"github.com/cloudwego/eino/utils/generic"
"github.com/cloudwego/eino/internal/generic"
)

// WorkflowNode is the node of the Workflow.
Expand Down
2 changes: 1 addition & 1 deletion flow/agent/multiagent/host/compose_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import (
"github.com/cloudwego/eino/components/prompt"
"github.com/cloudwego/eino/compose"
"github.com/cloudwego/eino/flow/agent"
"github.com/cloudwego/eino/internal/generic"
"github.com/cloudwego/eino/internal/mock/components/model"
"github.com/cloudwego/eino/schema"
"github.com/cloudwego/eino/utils/generic"
)

func TestHostMultiAgent(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/callbacks/inject.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package callbacks
import (
"context"

"github.com/cloudwego/eino/internal/generic"
"github.com/cloudwego/eino/schema"
"github.com/cloudwego/eino/utils/generic"
)

type CtxManagerKey struct{}
Expand Down
2 changes: 1 addition & 1 deletion internal/concat.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"strings"
"time"

"github.com/cloudwego/eino/utils/generic"
"github.com/cloudwego/eino/internal/generic"
)

var (
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
28 changes: 28 additions & 0 deletions internal/safe/panic_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright 2025 CloudWeGo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package safe

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestPanicErr(t *testing.T) {
err := NewPanicErr("info", []byte("stack"))
assert.Equal(t, "panic error: info, \nstack: stack", err.Error())
}
2 changes: 1 addition & 1 deletion schema/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

"github.com/stretchr/testify/assert"

"github.com/cloudwego/eino/utils/generic"
"github.com/cloudwego/eino/internal/generic"
)

func TestMessageTemplate(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion schema/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"sync"
"sync/atomic"

"github.com/cloudwego/eino/utils/safe"
"github.com/cloudwego/eino/internal/safe"
)

// ErrNoValue is used during StreamReaderWithConvert to skip a streamItem, excluding it from the converted stream.
Expand Down
Loading