mirror of
https://github.com/vxcontrol/langchaingo.git
synced 2026-08-25 11:10:02 -04:00
064f09155c
- Raised the `go` directive from 1.24.1 to 1.26.5 to satisfy pgx/v5 and ollama's minimum Go version requirements and to pick up 15 patched standard library CVEs. - Updated `pgx/v5`, `otel`/`otel/sdk`/`otlptracehttp`, `x/net`, and the AWS `eventstream` protocol package to their latest requested versions. - Remediated govulncheck-flagged CVEs in `grpc`, `x/text`, `x/crypto`, `antchfx/xpath`, AWS SDK `bedrock*`/`s3` services, `etcd/server`, and `mongo-driver` v1/v2. - Fixed ollama's `MainGPU` API type change (`int` -> `*int`) in `llms/ollama/options.go` without breaking the public `WithRunnerMainGPU` signature.
OpenAI O1 Example
This example demonstrates how to use the OpenAI O1 model with the LangChain Go library to generate content based on a prompt.
What This Example Does
- Initializes an OpenAI language model client, specifying the "o1-preview" model
- Sets up a prompt asking for ideas to build a Go app for question answering using a database
- Generates content from the model based on the prompt
- Prints the generated content and some metadata about the generation
Key Features
- Uses the OpenAI O1 preview model
- Demonstrates setting custom parameters like max tokens and temperature
- Shows how to extract and print generation metadata
How to Run
- Ensure you have Go installed and your OpenAI API credentials set up
- Run the example:
go run openai_o1_chat_example.go
- Optionally use the
-modelflag to specify a different model, e.g.:
go run openai_o1_chat_example.go -model o1-mini