Gemma, Ollama and LangChainGo
Eli Bendersky's website
by Eli Bendersky
1w ago
Yesterday Google released Gemma - an open LLM that folks can run locally on their machines (similarly to llama2). I was wondering how easy it would be to run Gemma on my computer, chat with it and interact with it from a Go program. Turns it - thanks to Ollama - it's extremely easy! Gemma was already added to Ollama, so all one has to do is run: $ ollama run gemma And wait for a few minutes while model downloads. From this point on, my previous post about using Ollama locally in Go applies with pretty much no changes. Gemma becomes available through a REST API locally, and can be accessed f ..read more
Visit website
Using Gemini models in Go with LangChainGo
Eli Bendersky's website
by Eli Bendersky
1M ago
In a previous post I've discussed how to access Google's multimodal Gemini models from Go (with a nice free tier!) Recently, Google's SDKs were added as providers for LangChainGo; this makes it possible to use the capabilities of the LangChain framework with Google's Gemini models as LLM providers. This post shows some samples of using these new providers and how simple it is to switch providers from Google AI (which uses API keys) to Vertex (which requires a GCP project). LangChainGo examples with GoogleAI Let's start with the GoogleAI provider. We'll need the latest release of langchaingo. H ..read more
Visit website
Sign in with Google in Go
Eli Bendersky's website
by Eli Bendersky
1M ago
This post provides some code samples for implementing a "Sign-in with Google" flow for your web application in Go. For an overview of auth/authz and the OAuth protocol, please refer to my earlier post about Sign-in with GitHub. Sign-in with Google has existed in one form or another for many years, and the technical approach to it evolved over time. I will start by presenting the currently recommended way - and the one that will feel most familiar to users - and will then mention a slightly more complicated and flexible alternative. Using Google Identity Service (GIS) The currently recommended ..read more
Visit website
Summary of reading: October - December 2023
Eli Bendersky's website
by Eli Bendersky
2M ago
"Nomadland: Surviving America in the Twenty-First Century" by Jessica Bruder - describes the lives of the modern van-dwellers, mostly of older adults that travel around the country between seasonal jobs and live in their RVs or cars. Interesting book that tells a good story and avoids being preachy most of the time. "Oxygen: The molecule that made the world" by Nick Lane - one of Lane's earliest books. Like the others, it's a packed whirlwhind tour of biochemistry, loaded with enough information to cover a couple of graduate courses and enough ideas to kick-start a hundred new research projec ..read more
Visit website
Using Gemini models from Go
Eli Bendersky's website
by Eli Bendersky
2M ago
Google has recently made their newest family of multimodal LLMs available via an API with a generous free tier. Google also released SDKs in several popular programming languages, including Go. This post is a quick overview of how to get started with the Go SDK to ask the model questions that mix text with images. The task We'll be asking the model to explain the difference between two images of turtles; this one: And this one: Using the Google AI SDK With the Google AI SDK, all you need to access the model is generate an API key (similarly to how it works with OpenAI's API). The Go SDK live ..read more
Visit website
Using Ollama with LangChainGo
Eli Bendersky's website
by Eli Bendersky
3M ago
One of the most exciting areas of LLM-related development in 2023 is the availability of powerful (and sometimes even open-source) models we can run locally on our machines. Several tools exist that make it relatively easy to obtain, run and manage such models locally; for example Ollama (written in Go!) LocalAI (also largely in Go!). In this post I'm going to describe how to use Ollama to run a model locally, communicate with it using its API and integrate it into a Go program using LangChainGo. Setting up Ollama To start, follow the installation and setup instructions from the Ollama websit ..read more
Visit website
Retrieval Augmented Generation in Go
Eli Bendersky's website
by Eli Bendersky
4M ago
I've been reading more and more about LLM-based applications recently, itching to build something useful as a learning experience. In this post, I want to share a Retrieval Augmented Generation (RAG) system I've built in 100% Go and some insights I learned along the way. Some limitations of current LLMs Let's take OpenAI's API as an example; for your hard-earned dollars, it gives you access to powerful LLMs and related models. These LLMs have some limitations as a general knowledge system [1]: They have a training cutoff date somewhere in the past; recently, OpenAI moved the cutoff of their G ..read more
Visit website
ES Module imports in Node.js and the browser
Eli Bendersky's website
by Eli Bendersky
4M ago
For a recent project, I wanted to have some JS code (in multiple files) available for testing from the command-line with Node.js, but also to be able to load the same code into a web page to be invoked directly from a browser. I've encountered this same issue before for my in-browser 8080 assembler and simulator project, and used a combination of CommonJS requires with a bundler tool to make it work. But we're in 2023 now, and CommonJS is supposed to be phasing out. So my goal for the new project was to do this using ES modules (ESM) and without any separate tooling. Let's see how it works. Pr ..read more
Visit website
Better HTTP server routing in Go 1.22
Eli Bendersky's website
by Eli Bendersky
4M ago
An exciting proposal is expected to land in Go 1.22 - enhancing the pattern-matching capabilities of the default HTTP serving multiplexer in the net/http package. The existing multiplexer (http.ServeMux) offers rudimentary path matching, but not much beyond that. This led to a cottage industry of 3rd party libraries to implement more powerful capabilities. I've explored these options in my REST Servers in Go series, in parts 1 and 2. The new multiplexer in 1.22 is going to significantly bridge the gap from 3rd party packages by providing advanced matching. In this short post I'll provide a qui ..read more
Visit website
Cubic spline interpolation
Eli Bendersky's website
by Eli Bendersky
5M ago
This post explains how cubic spline interpolation works, and presents a full implementation in JavaScript, hooked up to a SVG-based visualization. As a side effect, it also covers Gaussian elimination and presents a JavaScript implementation of that as well. I love topics that mix math and programming in a meaningful way, and cubic spline interpolation is an excellent example of such a topic. There's a bunch of linear algebra here and some calculus, all connected with code to create a useful tool. Motivation In an interpolation problem, we're given a set of points (we'll be using 2D points X,Y ..read more
Visit website

Follow Eli Bendersky's website on FeedSpot

Continue with Google
Continue with Apple
OR