MCPcopy Create free account
hub / github.com/cloudwego/eino-examples / ExampleOfCreateByAnyLambda

Function ExampleOfCreateByAnyLambda

components/lambda/lambda.go:39–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37}
38
39func ExampleOfCreateByAnyLambda() {
40 // input 和 output 类型为自定义的任何类型
41 lambda, _ := compose.AnyLambda(
42 // Invoke 函数
43 func(ctx context.Context, input string, opts ...MyOption) (output string, err error) {
44 // some logic
45 return "", nil
46 },
47 // Stream 函数
48 func(ctx context.Context, input string, opts ...MyOption) (output *schema.StreamReader[string], err error) {
49 // some logic
50 return nil, nil
51 },
52 // Collect 函数
53 func(ctx context.Context, input *schema.StreamReader[string], opts ...MyOption) (output string, err error) {
54 // some logic
55 return "", nil
56 },
57 // Transform 函数
58 func(ctx context.Context, input *schema.StreamReader[string], opts ...MyOption) (output *schema.StreamReader[string], err error) {
59 // some logic
60 return nil, nil
61 },
62 )
63 _ = lambda
64}
65
66func ExampleOfCreateByInvokableLambdaWithOptions() {
67 lambda := compose.InvokableLambdaWithOption(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected