File size: 684 Bytes
8319bea
 
1b9d2d8
8319bea
 
1b9d2d8
8319bea
 
1b9d2d8
 
 
8319bea
 
 
1b9d2d8
 
8319bea
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import os
from dotenv import load_dotenv
import ollama
from langchain_community.llms import Ollama
from langchain_ollama import OllamaLLM

load_dotenv()
"""
res = ollama.generate(
    model="hf.co/bartowski/Llama-3.2-3B-Instruct-uncensored-GGUF:Q5_K_S",
    # model="qwen2.5:3b",
    prompt="what was our previous conversation?",
    system="only funny responses",
    # options={'num_predict': 50}
)

print("\n",res['response'],"\n")
"""

model = OllamaLLM(
    model=os.getenv('OLLAMA_MODEL_1', ''),
    # metadata={"num_predict": 50},
    num_predict=50,
    # num_ctx=50 
)

prompt_input = "Why did the tomato cry?"
response = model.invoke(prompt_input)

print("\n",response,"\n")