Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tusharad/ollama-haskell
Haskell bindings for Ollama
https://github.com/tusharad/ollama-haskell
Last synced: 2 months ago
JSON representation
Haskell bindings for Ollama
- Host: GitHub
- URL: https://github.com/tusharad/ollama-haskell
- Owner: tusharad
- License: mit
- Created: 2024-08-20T16:12:02.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-10-18T09:01:56.000Z (3 months ago)
- Last Synced: 2024-10-30T05:23:11.114Z (2 months ago)
- Language: Haskell
- Size: 3.04 MB
- Stars: 19
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Ollama-haskell
**ollama-haskell** is an unofficial Haskell binding for [Ollama](https://ollama.com), similar to [`ollama-python`](https://github.com/ollama/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
```haskell
{-# LANGUAGE OverloadedStrings #-}
module Lib whereimport 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
```bash
ghci> import Lib
ghci> mainWhether 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 `src/OllamaExamples.hs` file.
## Prerequisite
Make sure you have [Ollama](https://ollama.com) installed and running on your local machine. You can download it from [here](https://ollama.com/download).
## How to Use It
1. Include the `ollama-haskell` package in your `.cabal` file:
```cabal
build-depends:
base >= 4.7 && < 5,
ollama-haskell
```3. Import the `Ollama` module and start integrating with your local LLM.
## Future Updates
- [x] Improve documentation
- [x] Add tests.
- [x] Add examples.
- [x] Add CI/CD pipeline.
- [ ] `options` parameter in `generate`.Stay tuned for future updates and improvements!
## Author
This library is developed and maintained by [Tushar](https://github.com/tusharad). 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.