-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from DataUSA/chat-wrapper
json any shape comparer + shapes
- Loading branch information
Showing
3 changed files
with
92 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
from langchain_community.llms import Ollama | ||
from langchain_community.chat_message_histories import ChatMessageHistory | ||
from langchain_core.prompts import PromptTemplate | ||
from langchain_core.runnables import RunnableSequence, RunnablePassthrough, RunnableLambda, RunnableParallel, chain | ||
from langchain_core.output_parsers import JsonOutputParser | ||
from wrapper.logsHandlerCallback import logsHandler | ||
from langchain.globals import set_debug, set_verbose | ||
from os import getenv | ||
import json | ||
from operator import itemgetter | ||
|
||
|
||
TABLES_PATH = getenv('TABLES_PATH') | ||
OLLAMA_URL = 'https://caleuche-ollama.datawheel.us' | ||
CONFIG_FILE_NAME = 'wrapper_datausa.json' | ||
|
||
model = Ollama( | ||
base_url= OLLAMA_URL, | ||
model= "llama2:7b-chat-q8_0", | ||
temperature= 0, | ||
).with_config( | ||
seed= 123, | ||
run_name= 'basic_llama', | ||
) | ||
|
||
model_adv = Ollama( | ||
base_url= OLLAMA_URL, | ||
model= 'mixtral:8x7b-instruct-v0.1-q4_K_M',#'gemma:7b-instruct-q4_K_M',// | ||
system= '', | ||
temperature= 0, | ||
).with_config( | ||
seed= 123, | ||
run_name= 'advance_mixtral', | ||
) | ||
|
||
# LLM Summary chat history | ||
# Summary question | ||
# route to question/no question/new question/complement question | ||
|
||
summary_sys_prompt = """ | ||
You are an expert analyzing chat from questions. | ||
""" | ||
|
||
summary_prompt = """ | ||
Summarize the following chat history | ||
Output format: | ||
{{ | ||
}} | ||
""" | ||
@chain | ||
def route_question(info): | ||
pass | ||
|
||
|
||
# Use table_table selection | ||
from ..table_selection.table_selector import get_relevant_tables_from_database | ||
|
||
# LLM Classification | ||
# rerank RAG answer pick a cube | ||
|
||
|
||
|
||
# Call Schema Json to build Form JSON | ||
|
||
|
||
# LLM validation | ||
# Extract variables | ||
# Route ask missing variables | ||
# Offer members for missing variables | ||
|
||
|
||
|
||
# Build Chain | ||
|
||
|
||
# Export function |
This file contains 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