from langchain_core.output_parsers.openai_tools import PydanticToolsParser
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.pydantic_v1 import BaseModel, Field
from app import mysql, llm
from openai_module import init_openai
from operator import itemgetter
from langchain.chains import create_sql_query_chain
from langchain_core.runnables import RunnablePassthrough
class Table(BaseModel):
"""Table in SQL database."""
name: str = Field(description="Name of table in SQL database.")
def invoke_table_chain(user_input):
try:
table_names = "\n".join(mysql.get_usable_table_names())
system = f"""Return the names of ALL the SQL tables that MIGHT be relevant to the user question. \
The tables are:
{table_names}
Remember to include ALL POTENTIALLY RELEVANT tables, even if you're not sure that they're needed.
"""
prompt = ChatPromptTemplate.from_messages(
[
("system", system),
("human", f"{user_input}"),
]
)
llm_with_tools = llm.bind_tools([Table])
output_parser = PydanticToolsParser(tools=[Table])
table_chain = prompt | llm_with_tools | output_parser
table_chain.invoke({"input": f'{user_input}'})
query_chain = create_sql_query_chain(llm, mysql)
# Convert "question" key to the "input" key expected by current table_chain.
table_chain = {"input": itemgetter(f"{user_input}")} | table_chain
# Set table_names_to_use using table_chain.
full_chain = RunnablePassthrough.assign(table_names_to_use=table_chain) | query_chain
print(f"full_chain: \n{full_chain}\n")
query = full_chain.invoke({"question": f'{user_input}'})
return query
except Exception as ex:
print(f"In invoke_table_chain() => {ex}")
return None
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.pydantic_v1 import BaseModel, Field
from app import mysql, llm
from openai_module import init_openai
from operator import itemgetter
from langchain.chains import create_sql_query_chain
from langchain_core.runnables import RunnablePassthrough
class Table(BaseModel):
"""Table in SQL database."""
name: str = Field(description="Name of table in SQL database.")
def invoke_table_chain(user_input):
try:
table_names = "\n".join(mysql.get_usable_table_names())
system = f"""Return the names of ALL the SQL tables that MIGHT be relevant to the user question. \
The tables are:
{table_names}
Remember to include ALL POTENTIALLY RELEVANT tables, even if you're not sure that they're needed.
"""
prompt = ChatPromptTemplate.from_messages(
[
("system", system),
("human", f"{user_input}"),
]
)
llm_with_tools = llm.bind_tools([Table])
output_parser = PydanticToolsParser(tools=[Table])
table_chain = prompt | llm_with_tools | output_parser
table_chain.invoke({"input": f'{user_input}'})
query_chain = create_sql_query_chain(llm, mysql)
# Convert "question" key to the "input" key expected by current table_chain.
table_chain = {"input": itemgetter(f"{user_input}")} | table_chain
# Set table_names_to_use using table_chain.
full_chain = RunnablePassthrough.assign(table_names_to_use=table_chain) | query_chain
print(f"full_chain: \n{full_chain}\n")
query = full_chain.invoke({"question": f'{user_input}'})
return query
except Exception as ex:
print(f"In invoke_table_chain() => {ex}")
return None
🇾🇪 +20 Egypt 🇾🇪
🇵🇭 +63 Philippine 🇵🇭
🇿🇦 +27 South Africa 🇿🇦
🇧🇩 +880 Bangladesh 🇧🇩
🇨🇱 +56 Chile 🇨🇱
🇮🇱 +972 Israel 🇮🇱
🇱🇹 +95 Myanmar 🇱🇹
🇬🇧 +44 UK 🇬🇧
🇮🇳 +91 India 🇮🇳
🇵🇱 +62 Indonesia 🇵🇱
🇵🇰 +92 Pakistan 🇵🇰
⚡️ Session+Json 和 Tdata 可用 ⚡️
✅库存每天有 10,000 个账户
🛍 价格实惠,质量一流🛍
🕦Dm
🇵🇭 +63 Philippine 🇵🇭
🇿🇦 +27 South Africa 🇿🇦
🇧🇩 +880 Bangladesh 🇧🇩
🇨🇱 +56 Chile 🇨🇱
🇮🇱 +972 Israel 🇮🇱
🇱🇹 +95 Myanmar 🇱🇹
🇬🇧 +44 UK 🇬🇧
🇮🇳 +91 India 🇮🇳
🇵🇱 +62 Indonesia 🇵🇱
🇵🇰 +92 Pakistan 🇵🇰
⚡️ Session+Json 和 Tdata 可用 ⚡️
✅库存每天有 10,000 个账户
🛍 价格实惠,质量一流🛍
🕦Dm
专业号商 Tdata , Session , Json .
🇾🇪 +20 Egypt 🇾🇪
🇵🇭 +63 Philippine 🇵🇭
🇿🇦 +27 South Africa 🇿🇦
🇧🇩 +880 Bangladesh 🇧🇩
🇨🇱 +56 Chile 🇨🇱
🇮🇱 +972 Israel 🇮🇱
🇱🇹 +95 Myanmar 🇱🇹
🇬🇧 +44 UK 🇬🇧
🇮🇳 +91 India 🇮🇳
🇵🇱 +62 Indonesia 🇵🇱
🇵🇰 +92 Pakistan 🇵🇰
⚡️ Session+Json 和 Tdata 可用 ⚡️
✅库存每天有 10,000 个账户
🛍 价格实惠,质量一流🛍
🕦Dm
🇾🇪 +20 Egypt 🇾🇪
🇵🇭 +63 Philippine 🇵🇭
🇿🇦 +27 South Africa 🇿🇦
🇧🇩 +880 Bangladesh 🇧🇩
🇨🇱 +56 Chile 🇨🇱
🇮🇱 +972 Israel 🇮🇱
🇱🇹 +95 Myanmar 🇱🇹
🇬🇧 +44 UK 🇬🇧
🇮🇳 +91 India 🇮🇳
🇵🇱 +62 Indonesia 🇵🇱
🇵🇰 +92 Pakistan 🇵🇰
⚡️ Session+Json 和 Tdata 可用 ⚡️
✅库存每天有 10,000 个账户
🛍 价格实惠,质量一流🛍
🕦Dm
🇲🇲 缅甸 +95(10000)
🇧🇩 孟加拉国 +880 (10000)
🇵🇭菲律宾 +63 (10000)
🇳🇬尼日利亚 +234 (10000)
🇺🇸🇨🇦 美国、加拿大 +1 (10000)
🇵🇰巴基斯坦 +92 (10000)
🇮🇩印度尼西亚 +62 (10000)
🇮🇷伊朗 +98 (10000)
🇱🇻拉脱维亚 +371 (10000)
🇮🇱 以色列 +972 (10000)
🇮🇳印度 +91(10000)
Available for today ✅✅
格式(会议 + 会议 + 日期)那些需要这些国家的收件箱
💸价格便宜,质量好。
联系方式
🇧🇩 孟加拉国 +880 (10000)
🇵🇭菲律宾 +63 (10000)
🇳🇬尼日利亚 +234 (10000)
🇺🇸🇨🇦 美国、加拿大 +1 (10000)
🇵🇰巴基斯坦 +92 (10000)
🇮🇩印度尼西亚 +62 (10000)
🇮🇷伊朗 +98 (10000)
🇱🇻拉脱维亚 +371 (10000)
🇮🇱 以色列 +972 (10000)
🇮🇳印度 +91(10000)
Available for today ✅✅
格式(会议 + 会议 + 日期)那些需要这些国家的收件箱
💸价格便宜,质量好。
联系方式
✔️TG 可用帐户
格式 Dual Formats (Sessions+json) 和 Direct Login_Number (Tdata)
关注国家
🇮🇩 +62 Indonesia
🇲🇲 +95 Myanmar
🇮🇳 +91 India
🇮🇱 +972 Israel
🇺🇸 +1 usa
🇳🇬 +234 Nigeria
🇵🇰 +92 Pakistan
还有更多。
联系 :@Session_Json_Tdata_Storm
格式 Dual Formats (Sessions+json) 和 Direct Login_Number (Tdata)
关注国家
🇮🇩 +62 Indonesia
🇲🇲 +95 Myanmar
🇮🇳 +91 India
🇮🇱 +972 Israel
🇺🇸 +1 usa
🇳🇬 +234 Nigeria
🇵🇰 +92 Pakistan
还有更多。
联系 :@Session_Json_Tdata_Storm
+33 | France | 1.85$ | 🇫🇷
+-----+-------------+----------+------|
+-----+-------------+----------+------|
+95
+63
+62
+234
Session+Json+tdata 可用
价格便宜,质量好。
封鎖率僅0-1%
您可以大量購買。
大量購買可享特別折扣。
联系方式 - @Session_Json_Tdata_Storm
+63
+62
+234
Session+Json+tdata 可用
价格便宜,质量好。
封鎖率僅0-1%
您可以大量購買。
大量購買可享特別折扣。
联系方式 - @Session_Json_Tdata_Storm