Skip to content

Instantly share code, notes, and snippets.

@dragonde
Last active May 1, 2024 17:20
Show Gist options
  • Save dragonde/7a31a191e15e158527a08f80c3426207 to your computer and use it in GitHub Desktop.
Save dragonde/7a31a191e15e158527a08f80c3426207 to your computer and use it in GitHub Desktop.
ollama test
import os
from langchain_community.llms import Ollama
llm = Ollama(model="solar")
project = 'auth-service'
directory = '/home/alber/repo/apps/' + project + '/kubernetes/chart/templates'
prompt = "given these helm templates make a values.yaml file with all the variables that appears in the templates. Output just the yaml file : \n"
def concatenate_txt_files(directory):
content_string = ''
for filename in os.listdir(directory):
if filename.endswith('.yaml'):
with open(os.path.join(directory, filename), 'r') as f:
content_string += f.read() + '\n'
return content_string
question = prompt + concatenate_txt_files(directory)
# print(result)
output = llm.invoke(question)
with open(project + '.values.yaml', 'w') as f:
f.write(output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment