diff --git a/ollama_class.py b/ollama_class.py new file mode 100644 index 0000000..4b9217d --- /dev/null +++ b/ollama_class.py @@ -0,0 +1,15 @@ +import ollama + +class Ollama: + def __init__(self, model='llama3:8b-instruct-q5_K_M', temperature=0): + self.model = model + self.temperature = temperature + + def generate(self, prompt): + return ollama.generate(prompt=prompt, model=self.model, options={'temperature': self.temperature})['response'] + + +if __name__ == "__main__": + # Example usage + prompt = 'Tell me a joke!' + ollama = Ollama() \ No newline at end of file