mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-17 07:26:16 +00:00
@@ -6,7 +6,7 @@ a language model is used as a reasoning engine to determine which actions
|
||||
to take and in which order.
|
||||
|
||||
Agents select and use **Tools** and **Toolkits** for actions.
|
||||
""" # noqa: E501
|
||||
"""
|
||||
from langchain_experimental.agents.agent_toolkits import (
|
||||
create_csv_agent,
|
||||
create_pandas_dataframe_agent,
|
||||
|
@@ -220,7 +220,7 @@ def create_pandas_dataframe_agent(
|
||||
verbose=True
|
||||
)
|
||||
|
||||
""" # noqa: E501
|
||||
"""
|
||||
try:
|
||||
if engine == "modin":
|
||||
import modin.pandas as pd
|
||||
|
@@ -149,7 +149,7 @@ class Llama2Chat(ChatWrapper):
|
||||
|
||||
|
||||
class Mixtral(ChatWrapper):
|
||||
"""See https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1#instruction-format""" # noqa: E501
|
||||
"""See https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1#instruction-format"""
|
||||
|
||||
@property
|
||||
def _llm_type(self) -> str:
|
||||
|
@@ -88,7 +88,7 @@ class BashProcess:
|
||||
|
||||
Args:
|
||||
Prompt(str): the bash command to execute
|
||||
""" # noqa: E501
|
||||
"""
|
||||
pexpect = self._lazy_import_pexpect()
|
||||
process = pexpect.spawn(
|
||||
"env", ["-i", "bash", "--norc", "--noprofile"], encoding="utf-8"
|
||||
@@ -107,7 +107,7 @@ class BashProcess:
|
||||
Args:
|
||||
commands(List[str]): a list of commands to
|
||||
execute in the session
|
||||
""" # noqa: E501
|
||||
"""
|
||||
if isinstance(commands, str):
|
||||
commands = [commands]
|
||||
commands = ";".join(commands)
|
||||
@@ -125,7 +125,7 @@ class BashProcess:
|
||||
|
||||
Args:
|
||||
command: The command to run
|
||||
""" # noqa: E501
|
||||
"""
|
||||
try:
|
||||
output = subprocess.run(
|
||||
command,
|
||||
@@ -149,7 +149,7 @@ class BashProcess:
|
||||
Args:
|
||||
output: a process' output string
|
||||
command: the executed command
|
||||
""" # noqa: E501
|
||||
"""
|
||||
pattern = re.escape(command) + r"\s*\n"
|
||||
output = re.sub(pattern, "", output, count=1)
|
||||
return output.strip()
|
||||
@@ -161,7 +161,7 @@ class BashProcess:
|
||||
|
||||
Args:
|
||||
command: the command to execute
|
||||
""" # noqa: E501
|
||||
"""
|
||||
pexpect = self._lazy_import_pexpect()
|
||||
if self.process is None:
|
||||
raise ValueError("Process not initialized")
|
||||
|
@@ -3,7 +3,7 @@
|
||||
See the paper: https://arxiv.org/pdf/2211.10435.pdf.
|
||||
|
||||
This chain is vulnerable to [arbitrary code execution](https://github.com/langchain-ai/langchain/issues/5872).
|
||||
""" # noqa: E501
|
||||
"""
|
||||
from langchain_experimental.pal_chain.base import PALChain
|
||||
|
||||
__all__ = ["PALChain"]
|
||||
|
@@ -3,7 +3,7 @@
|
||||
[Amazon Personalize](https://docs.aws.amazon.com/personalize/latest/dg/what-is-personalize.html)
|
||||
is a fully managed machine learning service that uses your data to generate
|
||||
item recommendations for your users.
|
||||
""" # noqa: E501
|
||||
"""
|
||||
from langchain_experimental.recommenders.amazon_personalize import AmazonPersonalize
|
||||
from langchain_experimental.recommenders.amazon_personalize_chain import (
|
||||
AmazonPersonalizeChain,
|
||||
|
@@ -475,7 +475,7 @@ class RLChain(Chain, Generic[TEvent]):
|
||||
def save_progress(self) -> None:
|
||||
"""
|
||||
This function should be called to save the state of the learned policy model.
|
||||
""" # noqa: E501
|
||||
"""
|
||||
self.active_policy.save()
|
||||
|
||||
def _validate_inputs(self, inputs: Dict[str, Any]) -> None:
|
||||
|
@@ -25,7 +25,7 @@ def test_prompt(model: Mixtral) -> None:
|
||||
|
||||
actual = model.invoke(messages).content # type: ignore
|
||||
expected = (
|
||||
"<s>[INST] sys-msg\nusr-msg-1 [/INST] ai-msg-1 </s> [INST] usr-msg-2 [/INST]" # noqa: E501
|
||||
"<s>[INST] sys-msg\nusr-msg-1 [/INST] ai-msg-1 </s> [INST] usr-msg-2 [/INST]"
|
||||
)
|
||||
|
||||
assert actual == expected
|
||||
|
@@ -78,7 +78,7 @@ string = "racecar"
|
||||
if string == string[::-1]:
|
||||
print(string, "is a palindrome") # noqa: T201
|
||||
else:
|
||||
print(string, "is not a palindrome")""" # noqa: T201
|
||||
print(string, "is not a palindrome")"""
|
||||
tool = PythonAstREPLTool()
|
||||
assert tool.run(program) == "racecar is a palindrome\n"
|
||||
|
||||
|
Reference in New Issue
Block a user