at least this kind of works

This commit is contained in:
2026-04-22 09:50:49 -04:00
parent 467e3d251e
commit 681ede0bbb
6 changed files with 171 additions and 1 deletions

36
archive/tool_test.py Normal file
View File

@@ -0,0 +1,36 @@
# TOOL USE TEST
import ollama
system_prompt = """You have access to a list. If you want to retrieve the content in the list, output EXACTLY:
$DATABASE$
Do not output anything else. The result will be returned in a string starting with [DATABASE].
"""
context_prompt = None # if context exists
user_input = "Check the list and tell me what is in there"
combined_system = f"{system_prompt}\n\nContext: {context_prompt}"
stream = ollama.chat(
model='llama3.2',
messages=[
{'role': 'system', 'content': combined_system},
{'role': 'user', 'content': user_input},
],
stream=True,
)
# Accumulate chunks into a variable
full_response = ""
for chunk in stream:
content = chunk['message']['content']
print(content, end='', flush=True)
full_response += content
if "$DATABASE$" in full_response:
# DATABASE LOGIC TODO
pass
print() # newline after streaming
print(full_response) # your complete output