https://github.com/mashiike/langchaingo-llm-bedrock
https://github.com/mashiike/langchaingo-llm-bedrock
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mashiike/langchaingo-llm-bedrock
- Owner: mashiike
- License: mit
- Created: 2024-03-15T02:47:55.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-29T20:54:41.000Z (about 1 year ago)
- Last Synced: 2024-05-01T16:15:23.284Z (about 1 year ago)
- Language: Go
- Size: 84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# langchaingo-llm-bedrock
for `github.com/tmc/langchaingo` Amazon Bedrock LLM interface implement
[](https://godoc.org/github.com/mashiike/langchaingo-llm-bedrock)
[](https://goreportcard.com/report/github.com/mashiike/langchaingo-llm-bedrock)
[](https://opensource.org/licenses/MIT)## Example
```go
package mainimport (
"context"
_ "embed"
"log"bedrock "github.com/mashiike/langchaingo-llm-bedrock"
"github.com/tmc/langchaingo/llms"
"github.com/tmc/langchaingo/schema"
)//go:embed image.png
var image []bytefunc main() {
llm, err := bedrock.New(
bedrock.WithModel(bedrock.Claude3Haiku),
)
if err != nil {
log.Fatal(err)
}
ctx := context.Background()
resp, err := llm.GenerateContent(ctx, []llms.MessageContent{
{
Role: schema.ChatMessageTypeHuman,
Parts: []llms.ContentPart{
llms.BinaryPart("image/png", image),
llms.TextPart("この画像に書かれている内容をテキストにしてください。"),
},
},
})
if err != nil {
log.Fatal(err)
}
for _, choice := range resp.Choices {
log.Println(choice.Content)
}
}
```## License
MIT License