quick-llama


Namequick-llama JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/nuhmanpk/quick-llama
SummaryRun Ollama models easily, anywhere – including online platforms like Google Colab
upload_time2025-07-08 12:34:22
maintainerNone
docs_urlNone
authorNuhman PK
requires_python>=3.10
licenseNone
keywords ollama llama3 colab ai open-source openai llm quick-llama
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Quick Llama

[![PyPI version](https://badge.fury.io/py/quick-llama.svg?icon=si%3Apython)](https://badge.fury.io/py/quick-llama)
[![Downloads](https://pepy.tech/badge/quick-llama)](https://pepy.tech/project/quick-llama)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![Contributors](https://img.shields.io/github/contributors/nuhmanpk/quick-llama.svg)](https://github.com/nuhmanpk/quick-llama/graphs/contributors)
[![GitHub last commit](https://img.shields.io/github/last-commit/nuhmanpk/quick-llama.svg)](https://github.com/nuhmanpk/quick-llama/commits)
[![Python versions](https://img.shields.io/pypi/pyversions/quick-llama.svg)](https://pypi.org/project/quick-llama/)


A Python wrapper for Ollama that simplifies managing and interacting with LLMs on colab with multi model and reasoning model support.

<p align="center">
  <img src="https://raw.githubusercontent.com/nuhmanpk/quick-llama/main/images/llama-image.webp" width="300" height="300" />
</p>

QuickLlama automates server setup, model management, and seamless interaction with LLMs, providing an effortless developer experience.

πŸš€ Colab-Ready: Easily run and experiment with QuickLlama on Google Colab for hassle-free, cloud-based development!

> **Note**: Don’t forget to use a GPU if you actually want it to perform well!

## Installtion

```sh
pip install quick-llama
```

```sh
!pip install quick-llama
```

### Serve a model
```py
from quick_llama import QuickLlama
model = 'gemma3'
quick_llama = QuickLlama(model_name=model,verbose=True)

quick_llama.init() # -> starts the server in background
```

### Serve QuickLlama

```py
from quick_llama import QuickLlama

from ollama import chat
from ollama import ChatResponse

# Defaults to gemma3
model = 'gemma3'
quick_llama = QuickLlama(model_name=model,verbose=True)

quick_llama.init()

response: ChatResponse = chat(model=model, messages=[
  {
    'role': 'user',
    'content': 'Why is the sky blue?',
  },
])
print(response['message']['content'])
# or access fields directly from the response object
print(response.message.content)

quick_llama.stop()

```

## MultiModels
```py
import requests
import os
from ollama import chat
from quick_llama import QuickLlama

model = 'gemma3'
quick_llama = QuickLlama(model_name=model,verbose=True)

quick_llama.init()

# Step 1: Download the image
img_url = "https://raw.githubusercontent.com/nuhmanpk/quick-llama/main/images/llama-image.webp" # quick llama cover photo
img_path = "temp_llama_image.webp"

with open(img_path, "wb") as f:
    f.write(requests.get(img_url).content)

# Step 2: Send the image to the model
response = chat(
    model=model,
    messages=[
        {
            "role": "user",
            "content": "Describe what you see in this photo.",
            "images": [img_path],
        }
    ]
)

# Step 3: Print the result
print(response['message']['content'])

# Step 4: Clean up the image file
os.remove(img_path)

```


```py
from quick_llama import QuickLlama


from ollama import chat
from ollama import ChatResponse

# Defaults to gemma3
quick_llama = QuickLlama(model_name="gemma3")

quick_llama.init()

response: ChatResponse = chat(model='gemma3', messages=[
  {
    'role': 'user',
    'content': 'what is 6 times 5?',
  },
])
print(response['message']['content'])

print(response.message.content)
```

## Use with Langchain 

```py
from quick_llama import QuickLlama
from langchain_ollama import OllamaLLM

model_name = "gemma3"

quick_llama = QuickLlama(model_name=model_name,verbose=True)

quick_llama.init()

model = OllamaLLM(model=model_name)
model.invoke("Come up with 10 names for a song about parrots")
```

## Use custom Models

```py
quick_llama = QuickLlama()  # Defaults to mistral
quick_llama.init()

# Custom Model
# Supports all models from https://ollama.com/search
quick_llama = QuickLlama(model_name="custom-model-name")
quick_llama.init()
```
## List Models

```py
quick_llama.list_models()
```

## Stop Model
```py
quick_llama.stop_model("gemma3")
```
## Stop Server

```py
quick_llama.stop()
```


Made with ❀️ by [Nuhman](https://github.com/nuhmanpk). Happy Coding πŸš€

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/nuhmanpk/quick-llama",
    "name": "quick-llama",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "ollama llama3 colab ai open-source openai llm quick-llama",
    "author": "Nuhman PK",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/c9/bf/bdfe5532a0ad7bc1a7b5cc113643a358b0e9a722041cc11e4ef19221ae05/quick_llama-0.1.0.tar.gz",
    "platform": null,
    "description": "# Quick Llama\n\n[![PyPI version](https://badge.fury.io/py/quick-llama.svg?icon=si%3Apython)](https://badge.fury.io/py/quick-llama)\n[![Downloads](https://pepy.tech/badge/quick-llama)](https://pepy.tech/project/quick-llama)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![Contributors](https://img.shields.io/github/contributors/nuhmanpk/quick-llama.svg)](https://github.com/nuhmanpk/quick-llama/graphs/contributors)\n[![GitHub last commit](https://img.shields.io/github/last-commit/nuhmanpk/quick-llama.svg)](https://github.com/nuhmanpk/quick-llama/commits)\n[![Python versions](https://img.shields.io/pypi/pyversions/quick-llama.svg)](https://pypi.org/project/quick-llama/)\n\n\nA Python wrapper for Ollama that simplifies managing and interacting with LLMs on colab with multi model and reasoning model support.\n\n<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/nuhmanpk/quick-llama/main/images/llama-image.webp\" width=\"300\" height=\"300\" />\n</p>\n\nQuickLlama automates server setup, model management, and seamless interaction with LLMs, providing an effortless developer experience.\n\n\ud83d\ude80 Colab-Ready: Easily run and experiment with QuickLlama on Google Colab for hassle-free, cloud-based development!\n\n> **Note**: Don\u2019t forget to use a GPU if you actually want it to perform well!\n\n## Installtion\n\n```sh\npip install quick-llama\n```\n\n```sh\n!pip install quick-llama\n```\n\n### Serve a model\n```py\nfrom quick_llama import QuickLlama\nmodel = 'gemma3'\nquick_llama = QuickLlama(model_name=model,verbose=True)\n\nquick_llama.init() # -> starts the server in background\n```\n\n### Serve QuickLlama\n\n```py\nfrom quick_llama import QuickLlama\n\nfrom ollama import chat\nfrom ollama import ChatResponse\n\n# Defaults to gemma3\nmodel = 'gemma3'\nquick_llama = QuickLlama(model_name=model,verbose=True)\n\nquick_llama.init()\n\nresponse: ChatResponse = chat(model=model, messages=[\n  {\n    'role': 'user',\n    'content': 'Why is the sky blue?',\n  },\n])\nprint(response['message']['content'])\n# or access fields directly from the response object\nprint(response.message.content)\n\nquick_llama.stop()\n\n```\n\n## MultiModels\n```py\nimport requests\nimport os\nfrom ollama import chat\nfrom quick_llama import QuickLlama\n\nmodel = 'gemma3'\nquick_llama = QuickLlama(model_name=model,verbose=True)\n\nquick_llama.init()\n\n# Step 1: Download the image\nimg_url = \"https://raw.githubusercontent.com/nuhmanpk/quick-llama/main/images/llama-image.webp\" # quick llama cover photo\nimg_path = \"temp_llama_image.webp\"\n\nwith open(img_path, \"wb\") as f:\n    f.write(requests.get(img_url).content)\n\n# Step 2: Send the image to the model\nresponse = chat(\n    model=model,\n    messages=[\n        {\n            \"role\": \"user\",\n            \"content\": \"Describe what you see in this photo.\",\n            \"images\": [img_path],\n        }\n    ]\n)\n\n# Step 3: Print the result\nprint(response['message']['content'])\n\n# Step 4: Clean up the image file\nos.remove(img_path)\n\n```\n\n\n```py\nfrom quick_llama import QuickLlama\n\n\nfrom ollama import chat\nfrom ollama import ChatResponse\n\n# Defaults to gemma3\nquick_llama = QuickLlama(model_name=\"gemma3\")\n\nquick_llama.init()\n\nresponse: ChatResponse = chat(model='gemma3', messages=[\n  {\n    'role': 'user',\n    'content': 'what is 6 times 5?',\n  },\n])\nprint(response['message']['content'])\n\nprint(response.message.content)\n```\n\n## Use with Langchain \n\n```py\nfrom quick_llama import QuickLlama\nfrom langchain_ollama import OllamaLLM\n\nmodel_name = \"gemma3\"\n\nquick_llama = QuickLlama(model_name=model_name,verbose=True)\n\nquick_llama.init()\n\nmodel = OllamaLLM(model=model_name)\nmodel.invoke(\"Come up with 10 names for a song about parrots\")\n```\n\n## Use custom Models\n\n```py\nquick_llama = QuickLlama()  # Defaults to mistral\nquick_llama.init()\n\n# Custom Model\n# Supports all models from https://ollama.com/search\nquick_llama = QuickLlama(model_name=\"custom-model-name\")\nquick_llama.init()\n```\n## List Models\n\n```py\nquick_llama.list_models()\n```\n\n## Stop Model\n```py\nquick_llama.stop_model(\"gemma3\")\n```\n## Stop Server\n\n```py\nquick_llama.stop()\n```\n\n\nMade with \u2764\ufe0f by [Nuhman](https://github.com/nuhmanpk). Happy Coding \ud83d\ude80\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Run Ollama models easily, anywhere \u2013 including online platforms like Google Colab",
    "version": "0.1.0",
    "project_urls": {
        "Documentation": "https://github.com/nuhmanpk/quick-llama/blob/main/README.md",
        "Funding": "https://github.com/sponsors/nuhmanpk",
        "Homepage": "https://github.com/nuhmanpk/quick-llama",
        "Source": "https://github.com/nuhmanpk/quick-llama/",
        "Tracker": "https://github.com/nuhmanpk/quick-llama/issues"
    },
    "split_keywords": [
        "ollama",
        "llama3",
        "colab",
        "ai",
        "open-source",
        "openai",
        "llm",
        "quick-llama"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1b550d948c4185071a9e56ede698e22568f502fa0e57664eb37e94801c0b6228",
                "md5": "4f08c12f3023b50526acda5d5e464c23",
                "sha256": "c27ca5d7fcca85dc86cd76d4179ea9bb532b6b4c4f83f8772a920f44b08ed610"
            },
            "downloads": -1,
            "filename": "quick_llama-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4f08c12f3023b50526acda5d5e464c23",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 5616,
            "upload_time": "2025-07-08T12:34:21",
            "upload_time_iso_8601": "2025-07-08T12:34:21.222112Z",
            "url": "https://files.pythonhosted.org/packages/1b/55/0d948c4185071a9e56ede698e22568f502fa0e57664eb37e94801c0b6228/quick_llama-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c9bfbdfe5532a0ad7bc1a7b5cc113643a358b0e9a722041cc11e4ef19221ae05",
                "md5": "338aaa97bbbc8e28f9a9a94f95abe684",
                "sha256": "af7a95d730e43a520b6dae0a4e592bad917f23e354a634012f14bb4c0f8c15b5"
            },
            "downloads": -1,
            "filename": "quick_llama-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "338aaa97bbbc8e28f9a9a94f95abe684",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 5300,
            "upload_time": "2025-07-08T12:34:22",
            "upload_time_iso_8601": "2025-07-08T12:34:22.009713Z",
            "url": "https://files.pythonhosted.org/packages/c9/bf/bdfe5532a0ad7bc1a7b5cc113643a358b0e9a722041cc11e4ef19221ae05/quick_llama-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-08 12:34:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nuhmanpk",
    "github_project": "quick-llama",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "quick-llama"
}
        
Elapsed time: 0.81971s