Created
March 19, 2025 18:41
-
-
Save tjwebb/046d241192eb6ef8fcdaf2ddd3e17c09 to your computer and use it in GitHub Desktop.
llm inside postgres
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ollama: | |
container_name: ollama_harmonizer | |
image: ollama/ollama:0.6.2 | |
build: | |
context: ./harmonizer | |
ports: | |
- "11434:11434" | |
restart: | |
unless-stopped |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create or replace function llm_prompt(model text, prompt text) returns text as $$ | |
import os | |
from ollama import Client | |
client = Client(host='http://ollama_harmonizer:11434') | |
response = client.chat(model=model, messages=[ | |
{ 'role': 'user', 'content': prompt } | |
]) | |
plpy.info(response.message.content) | |
return response.message.content | |
$$ language plpython3u; | |
select llm_prompt('gemma3:27b', 'why is the sky blue?'); |
Author
tjwebb
commented
Mar 19, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment