mirror of
https://github.com/SpudGunMan/meshing-around.git
synced 2026-05-08 14:24:28 +02:00
Update llm.py
This commit is contained in:
+5
-8
@@ -63,9 +63,8 @@ if llmEnableHistory:
|
||||
|
||||
"""
|
||||
|
||||
def llm_readTextFiles(directory):
|
||||
def llm_readTextFiles():
|
||||
# read .txt files in ../data/rag
|
||||
# return a list of strings
|
||||
try:
|
||||
import os
|
||||
# directory script path ../data/rag
|
||||
@@ -81,7 +80,6 @@ def llm_readTextFiles(directory):
|
||||
logger.debug(f"System: LLM readTextFiles: {e}")
|
||||
return False
|
||||
|
||||
|
||||
def embed_text(text):
|
||||
try:
|
||||
return embedding_model.embed_documents(text)
|
||||
@@ -139,13 +137,12 @@ def llm_query(input, nodeID=0, location_name=None):
|
||||
modelPrompt = meshBotAI.format(input=input, context='\n'.join(googleResults), location_name=location_name, llmModel=llmModel, history=history)
|
||||
|
||||
# RAG context inclusion
|
||||
# ragFolder = "data/rag"
|
||||
# radData = langchain.retrieve_rag_data(ragFolder)
|
||||
#ragContext = embed_text(llm_readTextFiles)
|
||||
ragContext = embed_text(llm_readTextFiles())
|
||||
# #ragQuery = langchain.generate_prompt(modelPrompt)
|
||||
|
||||
# Query the model
|
||||
#result = ollamaClient.generate(model=llmModel, prompt=modelPrompt, context=ragContext)
|
||||
result = ollamaClient.generate(model=llmModel, prompt=modelPrompt)
|
||||
result = ollamaClient.generate(model=llmModel, prompt=modelPrompt, context=ragContext)
|
||||
#result = ollamaClient.generate(model=llmModel, prompt=modelPrompt)
|
||||
|
||||
# Condense the result to just needed
|
||||
result = result.get("response")
|
||||
|
||||
Reference in New Issue
Block a user