Files
langchaingo/examples/nvidia-chat-completion
Dmitry Ng 064f09155c chore(deps): bump Go toolchain to 1.26.5 and fix vulnerable dependencies
- 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.
2026-08-04 13:57:26 +03:00
..
2024-06-20 23:47:52 -04:00

NVIDIA Chat Completion Example

Welcome to this exciting example of using NVIDIA's AI services with Go! 🚀

This project demonstrates how to leverage NVIDIA's API to perform chat completions using a powerful language model. It's a great way to see how easily you can integrate advanced AI capabilities into your Go applications.

What This Example Does

  1. Connects to NVIDIA's API: The code sets up a connection to NVIDIA's API using your API key.

  2. Uses a Specific Model: It's configured to use the "mistralai/mixtral-8x7b-instruct-v0.1" model, which is a large language model capable of generating human-like text.

  3. Sets Up a Chat Scenario: The example creates a chat scenario where the AI is instructed to be a Golang expert.

  4. Generates Content: It then asks the AI to explain why Go is a great fit for AI-based products.

  5. Streams the Response: The AI's response is streamed in real-time, printing each chunk of the answer as it's generated.

How to Run

  1. Make sure you have Go installed on your system.
  2. Set the NVIDIA_API_KEY environment variable with your NVIDIA API key.
  3. Run the example using go run nvidia_chat_completion_example.go.

Key Features

  • Easy Integration: Shows how simple it is to integrate NVIDIA's AI services into a Go application.
  • Streaming Responses: Demonstrates real-time streaming of AI-generated content.
  • Customizable Prompts: You can easily modify the system message and user prompt to explore different scenarios.

This example is perfect for developers looking to add AI-powered chat capabilities to their Go projects or those curious about how to interact with large language models programmatically.

Have fun exploring the world of AI with Go and NVIDIA! 🎉🤖