feat: initialize Eino examples and ADK applications
Include chat, weather, image, travel, streaming ASR and text examples, shared model initialization, documentation, and existing tests. Co-authored-by: TRAE CLI <traecli@bytedance.com>
This commit is contained in:
commit
81deca8c8e
75 files changed
+7048
No files matched your search
@@ -0,0 +1,45 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"example.com/ueino/pkg/llm"
|
||||
"example.com/ueino/steps/trans/internal"
|
||||
)
|
||||
|
||||
func main() {
|
||||
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
|
||||
defer cancel()
|
||||
|
||||
chain, err := internal.NewChain(ctx, llm.MustNewChatModel(ctx, "mini-chat"))
|
||||
if err != nil {
|
||||
log.Panicf("new chain err: %v", err)
|
||||
}
|
||||
|
||||
output, err := chain.Transform(ctx, internal.FakeInput())
|
||||
if err != nil {
|
||||
log.Panicf("chain transform err: %v", err)
|
||||
}
|
||||
defer output.Close()
|
||||
|
||||
for {
|
||||
message, err := output.Recv()
|
||||
if err == io.EOF {
|
||||
fmt.Println()
|
||||
break
|
||||
}
|
||||
if err != nil {
|
||||
log.Panicf("output received err: %v", err)
|
||||
}
|
||||
|
||||
fmt.Print(message.Content)
|
||||
}
|
||||
|
||||
log.Println("[I] Done!!!")
|
||||
}
|
||||
Reference in new issue
Block a user