ollama-haskell: Haskell bindings for ollama.

[ library, mit, ollama, web ] [ Propose Tags ] [ Report a vulnerability ]
Versions [RSS] 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.1.1.3, 0.1.2.0
Change log CHANGELOG.md
Dependencies aeson, base (>=4.7 && <5), base64-bytestring, bytestring, directory, filepath, http-client, http-types, text, time [details]
License MIT
Copyright 2024 tushar
Author tushar
Maintainer tusharadhatrao@gmail.com
Category Web
Home page https://github.com/tusharad/ollama-haskell#readme
Bug tracker https://github.com/tusharad/ollama-haskell/issues
Source repo head: git clone https://github.com/tusharad/ollama-haskell
Uploaded by tusharad at 2024-11-20T13:47:06Z
Distributions Stackage:0.1.2.0
Downloads 94 total (59 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2024-11-20 [all 1 reports]

Readme for ollama-haskell-0.1.2.0

[back to package description]

Ollama-haskell

ollama-haskell is an unofficial Haskell binding for Ollama, similar to ollama-python.

This library allows you to interact with Ollama, a tool that lets you run large language models (LLMs) locally, from within your Haskell projects.

Examples

{-# LANGUAGE OverloadedStrings #-}
module Lib where

import Ollama (GenerateOps(..), defaultGenerateOps, generate)

main :: IO ()
main = do
    void $
      generate
        defaultGenerateOps
          { modelName = "llama3.2"
          , prompt = "what is functional programming?"
          , stream = Just (T.putStr . Ollama.response_, pure ())
          }

Output

ghci> import Lib
ghci> main

Whether Haskell is a "good" language depends on what you're looking for in a programming language and your personal preferences. Here are some points to consider:

**Pros:**

1. **Strongly typed**: Haskell's type system ensures that you catch errors early, which leads to fewer bugs and easier maintenance.
2. **Functional programming paradigm**: Haskell encourages declarative coding, making it easier to reason about code and write correct programs.
3. **Garbage collection**: Haskell handles memory management automatically, freeing you from worries about manual memory deallocation.

You can find practical examples demonstrating how to use the library in the examples/OllamaExamples.hs file.

Prerequisite

Make sure you have Ollama installed and running on your local machine. You can download it from here.

How to Use It

  1. Include the ollama-haskell package in your .cabal file:

    build-depends:
        base >= 4.7 && < 5,
        ollama-haskell
    
  2. Import the Ollama module and start integrating with your local LLM.

Future Updates

  • Improve documentation
  • Add tests.
  • Add examples.
  • Add CI/CD pipeline.
  • options parameter in generate.

Stay tuned for future updates and improvements!

Author

This library is developed and maintained by Tushar. Feel free to reach out for any questions or suggestions!

Contributions

Contributions are welcome! If you'd like to improve the library, please submit a pull request or open an issue. Whether it's fixing bugs, adding new features, or improving documentation, all contributions are greatly appreciated.