File ~\.conda\envs\LLMS\lib\site-packages\langchain\agents\conversational\output_parser.py:26, in ConvoOutputParser.parse(self, text) 24 match = re.search(regex, text) 25 if not match: ---> 26 raise OutputParserException(f"Could not parse LLM output:
OutputParserException: Could not parse LLM output: `
Answer: "Hello, good morning. I am a helpful assistant.
Have a normal`
утро")`
Я также проверил https://python.langchain.com/docs/modul ... ing_errors< /p>
Я пробовал использовать ConversationalAgent и Initialize_agent, который имеет некоторые ограничения для моей цели.
Это код, который я пробовал
`
import os
from langchain.llms.huggingface_endpoint import HuggingFaceEndpoint
from langchain.llms import LlamaCpp
from langchain import PromptTemplate, LLMChain
from langchain.callbacks.manager import CallbackManager
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
import pandas as pd
from utils import *
llm_hf = HuggingFaceEndpoint(
endpoint_url="https://xxx",
huggingfacehub_api_token="xxx", task="text-generation"
)
from langchain.agents import create_sql_agent
from langchain.agents.agent_toolkits import SQLDatabaseToolkit
from langchain.sql_database import SQLDatabase
from langchain.llms.openai import OpenAI
from langchain.agents import AgentExecutor
from langchain.agents.agent_types import AgentType
from langchain.chat_models import ChatOpenAI
# Connect to the SQLite database (it will create a new one if it doesn't exist)
conn = sqlite3.connect('doctors.db')
# Replace 'table_name' with the name of the table you want to create in the database
table_name = 'Doctors'
# Use the `to_sql` method to save the DataFrame to the database
clean_df.to_sql(table_name, conn, if_exists='replace', index=False)
llm = llm_hf
db = SQLDatabase.from_uri("sqlite:///doctors.db")
db.get_table_names()
toolkit = SQLDatabaseToolkit(db=db,
llm=llm,
)
sql_executor = create_sql_agent(
llm=llm,
toolkit=toolkit,
verbose=True,
agent_type=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
top_k = 10000,
#agent_executor_kwargs={"return_intermediate_steps": True},
)
from langchain.agents import initialize_agent, Tool
tools = [
Tool(
name="Doctors Database System",
func=sql_executor.run,
return_direct=True,
description="useful to give information about doctors names, specialities and locations. Input should be a fully formed question.",
)
]
from langchain.agents import ZeroShotAgent, Tool, AgentExecutor, ConversationalAgent
from langchain.memory import ConversationBufferWindowMemory
from langchain.llms import OpenAI
from langchain.chains import LLMChain
prefix = """You are a helpful assistant.
Have a normal conversation with a human.
You can offer to answer questions about a database with doctor information.
You have access to the following tools:"""
suffix = """Begin!"
{chat_history}
Question: {input}
{agent_scratchpad}"""
prompt = ConversationalAgent.create_prompt(
tools,
prefix=prefix,
suffix=suffix,
input_variables=["input", "chat_history", "agent_scratchpad"],
)
memory = ConversationBufferWindowMemory(memory_key="chat_history", k = 5)
llm_chain = LLMChain(llm=llm, prompt=prompt)
agent = ConversationalAgent(llm_chain=llm_chain,
#output_parser= lambda **kwargs : dict(kwargs),
verbose=True)
agent_chain = AgentExecutor.from_agent_and_tools(
agent=agent, tools=tools, verbose=True, memory=memory
)
agent_chain.run("Hello, good `
Буду очень признателен. Любое предложение, спасибо!
Я столкнулся со следующей ошибкой в блокноте conda [code] File ~\.conda\envs\LLMS\lib\site-packages\langchain\agents\conversational\output_parser.py:26, in ConvoOutputParser.parse(self, text) 24 match = re.search(regex, text) 25 if not match: ---> 26 raise OutputParserException(f"Could not parse LLM output:[/code]{text}`") 27 action = match.group(1) 28 action_input = match.group(2) [code]OutputParserException: Could not parse LLM output: ` Answer: "Hello, good morning. I am a helpful assistant. Have a normal` [/code] утро")` Я также проверил https://python.langchain.com/docs/modules/agents/how_to/handle_parsing_errors< /p> Я пробовал использовать ConversationalAgent и Initialize_agent, который имеет некоторые ограничения для моей цели. Это код, который я пробовал ` [code]import os from langchain.llms.huggingface_endpoint import HuggingFaceEndpoint from langchain.llms import LlamaCpp from langchain import PromptTemplate, LLMChain from langchain.callbacks.manager import CallbackManager from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler import pandas as pd from utils import * llm_hf = HuggingFaceEndpoint( endpoint_url="https://xxx", huggingfacehub_api_token="xxx", task="text-generation" ) from langchain.agents import create_sql_agent from langchain.agents.agent_toolkits import SQLDatabaseToolkit from langchain.sql_database import SQLDatabase from langchain.llms.openai import OpenAI from langchain.agents import AgentExecutor from langchain.agents.agent_types import AgentType from langchain.chat_models import ChatOpenAI # Connect to the SQLite database (it will create a new one if it doesn't exist) conn = sqlite3.connect('doctors.db')
# Replace 'table_name' with the name of the table you want to create in the database table_name = 'Doctors'
# Use the `to_sql` method to save the DataFrame to the database clean_df.to_sql(table_name, conn, if_exists='replace', index=False)
from langchain.agents import initialize_agent, Tool tools = [ Tool( name="Doctors Database System", func=sql_executor.run, return_direct=True, description="useful to give information about doctors names, specialities and locations. Input should be a fully formed question.", ) ] from langchain.agents import ZeroShotAgent, Tool, AgentExecutor, ConversationalAgent from langchain.memory import ConversationBufferWindowMemory from langchain.llms import OpenAI from langchain.chains import LLMChain
prefix = """You are a helpful assistant. Have a normal conversation with a human. You can offer to answer questions about a database with doctor information. You have access to the following tools:""" suffix = """Begin!"
Я пытаюсь интегрировать API поиска Google в свой созданный агент, где агенту необходимо создать определенную структуру json для данного абзаца. В данном параграфе будут задачи, которые выполнил инженер. Таким образом, агент должен иметь возможность...
Я обучался LLM с помощью GSM8K. Когда я хочу это протестировать:
образец данных:
{'question': Every day, Wendi feeds each of her chickens three cups of mixed chicken feed, containing seeds, mealworms and vegetables to help keep them healthy. She...
Я пытался выполнить команду pip install -r require_versions.txt, но постоянно получаю эту ошибку. Честно говоря, я мало что знаю о Python или программировании, поэтому извините, если ответ очевиден. Ответы очень приветствуются!
× Preparing metadata...
Я запускаю ehartford_dolphin-2.1-mistral-7b на машине RTX A6000 на RunPod с шаблоном TheBloke LLM Text Generation WebUI.
У меня есть 2 варианта: запуск webui на runpod или запуск шаблона вывода HuggingFace Text Generation на runpod
Вариант 1....