Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

Yollama

what is this ?

This repo holds the code for helper functions for Ollama with Langchain.

prerequisites

This has been tested on a Ubuntu 24 server. You'll need:

  • Ollama installed
  • the Ollama models you'll need to install are:
default_llm_model_name = "ajindal/llama3.1-storm:8b"
default_long_context_llm_model_name = "mistral-nemo"
default_reasoning_llm_model_name = "gemma2:9b"
default_sql_llm_model_name = "qwen2.5-coder"
default_tools_llm_model_name = "qwen2.5"

The num_ctx parameter is the size of the context window used to generate the next token, here we use values for a 20GB VRAM GPU.

  • Python 3 with venv and pip installed

basic usage

pip install yollama

get_llm()

1st parameter is the use case (Literal["default", "long-context", "reasoning", "sql", "tools"]), which determines the model and context size.

2nd parameter is a boolean to determine if the LLM should return a JSON object or a string.

from yollama import get_llm

llm = get_llm()

# invoke default model (ajindal/llama3.1-storm:8b) in JSON mode
print(llm.invoke({"input_query": some_user_input}))
# invoke Mistral-Nemo model in text mode with some lengthy context
print(get_llm("long-context", False).invoke({"document": some_big_text}))
# invoke Gemma2 model in text mode, to get answers requiring more reasoning abilities
print(get_llm("reasoning", False).invoke({"question": """Owen left a tray of lemon cakes unattended in the staff room for an hour and one of the cakes went missing. Three people are suspects, and here are the facts:
Person A is allergic to citrus but was seen in the area
Person B loves lemon cake but wasn't near the location
Person C has stolen food before and similar incidents increased after they arrived
Who is most likely responsible and why?"""}))
# invoke Qwen2.5-Coder model in text mode, to get a raw SQL query
print(get_llm("sql", False).invoke({"query": "create a SQL query to get the latest headlines"}))

philosophy

fully local models

I've decided to let go of OpenAI to:

  • preserve my privacy
  • save money

As local models are getting better and better, I'm confident that I'll be able to have a greater experience in the future, even with my small 20GB VRAM GPU. 🤔 Of course, it's not fast, but hey everything comes with tradeoffs right? 💪

contributions guidelines

🤝 I haven't made up my mind on contribution guidelines yet. I guess we'll update them as you contribute!

Release files for yollama 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yollama 2.1.0
File Size Uploaded
yollama-2.1.0.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for yollama 2.1.0
File Interpreter ABI Platform
yollama-2.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.5 kB

Release files / yollama-2.1.0.tar.gz

Download URL yollama-2.1.0.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5d006ba82e5895bb80717e1c79fb698bcc1262612bec005be801ed389f069047
BLAKE2b-256 checksum
How to use checksums
a52619d2bc2bc01812a17219d700ce52397f717ace0bfd71a9fe298fd44e3cd7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.3

Release files / yollama-2.1.0-py3-none-any.whl

Download URL yollama-2.1.0-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
917c67e01030f90cee4d36ef4de51b90a8877a3de65883a1540577abc9794934
BLAKE2b-256 checksum
How to use checksums
8fdbee81424d4699d8f680db7076df749ec5d8acc173ce8b39dde7c62fe90833
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.3
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page