Skip to content

Latest commit

 

History

History
81 lines (54 loc) · 2.24 KB

README.md

File metadata and controls

81 lines (54 loc) · 2.24 KB

Practical GenAI with Go demo code

These are examples for my Practical GenAI with Go talk, which uses Parakeet to access Ollama both via its native and OpenAI-compatible endpoints.

Note: Many examples here are the same as those in the Parakeet repository.

Setup

All the demos use Ollama, so start that before running any.

ollama serve

Then, in another tab, pull the models. We use a medium size chat model to reduce hallucinations:

ollama pull qwen2.5:14b
ollama pull mxbai-embed-large

Agent

agent writes a new file READMUAH.md for you.

go run agent/main.go

Chat

chat completes a chat, then a follow-up message.

go run chat/main.go 

Markdown Context

markdown-context adds markdown into the system context. This allows the LLM to consider new information when generating a response.

go run markdown-context/main.go 

Markdown RAG

markdown-rag uses a VectorDB, Elasticsearch to store markdown fragments. Later, those similar to the user's prompt are retrieved into the system context. This allows the LLM to consider new information when generating a response.

Setup

First you need to have Elasticsearch running. You can use docker to start it: docker compose up -d. When done, stop it via docker compose down.

Create embeddings

create-embeddings loads go1.24.md and stores the embeddings in Elasticsearch.

go run markdown-rag/create-embeddings/main.go

Use Embeddings

use-embeddings does a similarity search in Elasticsearch based on the user's prompt to get relevant text fragments. Then, it places those in context to complete the prompt.

go run markdown-rag/use-embeddings/main.go