tgoop.com/golang_digest/133
Create:
Last Update:
Last Update:
GPT бот для работы с документацией Go
https://eli.thegreenplace.net/2023/retrieval-augmented-generation-in-go/
Как быть, если вы хотите спросить у GPT бота что-то по свежей документации Go, но его базы сильно устарели?
- You: what is the latest released version of the Go programming language?
- ChatGPT: As of my last update in April 2023, the latest stable version of Go
was 1.20.
- You: ...👌
Проблему можно решить с помощью Retrieval Augmented Generation (RAG), и Eli Bendersky в этой статье рассказывает как это делается. Ну и вкратце рассказывает, что такое RAG.
Если интересен только код, вот репозиторий этого проекта.
Пример ответа бота про вопрос о GOTOOLCHAIN (переменная окружения, которая появилась в Go 1.21):
In Go, `GOTOOLCHAIN` is an environment variable that determines which Go
toolchain version should be used. The value of `GOTOOLCHAIN` can be set to
various options:
1. `local`: This indicates that the bundled Go toolchain should be used.
2. `<name>`: This specifies a specific Go toolchain version that should
be used. If a binary with that name is found in the system PATH, it will be
used; otherwise, the `go` command will download and use the specified Go
toolchain.
3. `<name>+auto` or `<name>+path`: This tells the `go` command to
select and run a newer Go version as needed. It will consult the
`toolchain` and `go` lines in the current workspace's `go.work` file (or
the main module's `go.mod` file if there is no workspace) to determine
which toolchain version to use. If a newer version is specified in those
files, it will be used; otherwise, it will fallback to the default Go
toolchain.
Overall, `GOTOOLCHAIN` is used to specify the specific Go toolchain version or
the selection process of a newer Go version that should be used by the `go`
command.
#GPT #article #english