Overview

This is a memo on tools related to LLMs.

LangChain

https://www.langchain.com/

It is described as follows.

LangChain is a composable framework to build with LLMs. LangGraph is the orchestration framework for controllable agentic workflows.

LlamaIndex

https://docs.llamaindex.ai/en/stable/

It is described as follows.

LlamaIndex is a framework for building context-augmented generative AI applications with LLMs including agents and workflows.

LangChain and LlamaIndex

The response from gpt-4o was as follows.

Both LangChain and LlamaIndex are frameworks that support application development using LLMs (Large Language Models).

From a brief investigation, it appeared that LlamaIndex is easier to use when performing RAG (Retrieval-Augmented Generation).

Ollama

https://github.com/ollama/ollama

It is described as follows.

Get up and running with Llama 3.2, Mistral, Gemma 2, and other large language models.

It appears to be a tool for running LLMs in a local environment.

Download from the following page.

https://ollama.com/download

After launching the app, it could be used from commands like the following.

ollam/abyreunllama3.2

Additionally, by combining with LlamaIndex, Ollama could also be used from Python.

https://docs.llamaindex.ai/en/stable/api_reference/llms/ollama/

pipinstallllama-index-llms-ollama
flrprleromsimpn=otln(lOsraleemlsaa=p_moialnn(lsdmmeeo.)xdc.eollml=pm"lsle.ltoaelm(la"a3m.a2"i,mproe"rq)tueOsltl_atmiameout=60.0)

OpenRouter

https://openrouter.ai/docs/quick-start

It is described as follows.

OpenRouter provides an OpenAI-compatible completion API to 278 models & providers that you can call directly, or using the OpenAI SDK. Additionally, some third-party SDKs are available.

After account registration, you can select a model and try chat and other features.

By purchasing credits, gpt-4o and other models could also be used.

Additionally, by combining with LlamaIndex, OpenRouter could also be used from Python.

https://docs.llamaindex.ai/en/stable/api_reference/llms/openrouter/

After issuing an API key in OpenRouter, the following script could be executed.

The following is an example using the model Meta: Llama 3.2 1B Instruct (free).

fffilalmrprrrmopleerooopaimssimmmod_spnr_k=amatlldtdepog=(llooyOideraatotp_elemmese=ekl=lsaannne=mp__vvoRy"C.)ii(so=mhcnni).uaeahddmgtpttaeepeeiaMtxxotr_-e(..re(kls[lctnelsmlovyaaemrl(,mgsseo"aes..aO/(aoldPlrgpl_EloeemdNal]nsoRme)rtOa=oieU-"umnT3utpvE.seoR2err_-rtA1"iPb,mCI-ph_icoaKnortEsntMYtte"reOs)unpscteat=ng:"Reforuetee"r,")

The following is an example using the model OpenAI: GPT-4o (2024-11-20). By only changing model, the same script could be used.

pipinstallllama-index-llms-openrouter
lmrpleermssispn=matog=(Oderpeleel=lsn=mpR"C.)oohcupahtetaenMtrae((is[/smgaepgstes-(a4rgooe-l]2e)0=2"4u-s1e1r-"2,0"c,ontent="")

Model names can be found on pages like the following.

https://openrouter.ai/meta-llama/llama-3.2-1b-instruct:free

LiteLLM

https://www.litellm.ai/

It is described as follows.

LLM Gateway to manage authentication, loadbalancing, and spend tracking across 100+ LLMs. All in the OpenAI format.

The following describes how to use OpenRouter from LiteLLM.

https://docs.litellm.ai/docs/providers/openrouter

It could be executed with the following code.

pipinstalllitellm
fiarprmperopisimo_pnrkotlten(iysrtoeees=sl=ploomscn.ommsigmoeemepds.ptlescoeelahrnt=gotvi"ei(ooscc"np=eoO(e[smPn{[pEr0lNo"]eRuc.tOtomiUeneoTrtsnE/esRona_ptgAe"ePn:.Iac_i"oK/nEgtYpe"tn)-t4)o-"2,0"2r4o-l1e1"-:20""u,ser"}],

Summary

I have not fully understood the differences between the tools mentioned here, and there are likely many other useful tools available, but we hope this article serves as a useful reference for understanding the tools surrounding LLMs.