id
stringlengths
14
16
text
stringlengths
44
2.73k
source
stringlengths
49
114
95d0f83655e7-71
field CHUNK_LEN: int = 256# Batch size for prompt processing. field max_tokens_per_generation: int = 256# Maximum number of tokens to generate. field model: str [Required]# Path to the pre-trained RWKV model file. field penalty_alpha_frequency: float = 0.4# Positive values penalize new tokens based on their existing fr...
https://python.langchain.com/en/latest/reference/modules/llms.html
95d0f83655e7-72
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = β€˜allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclu...
https://python.langchain.com/en/latest/reference/modules/llms.html
95d0f83655e7-73
Get the number of tokens in the message. json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_...
https://python.langchain.com/en/latest/reference/modules/llms.html
95d0f83655e7-74
__call__(prompt: str, stop: Optional[List[str]] = None) β†’ str# Check Cache and run the LLM on the given prompt and input. async agenerate(prompts: List[str], stop: Optional[List[str]] = None) β†’ langchain.schema.LLMResult# Run the LLM on the given prompt and input. async agenerate_prompt(prompts: List[langchain.schema.P...
https://python.langchain.com/en/latest/reference/modules/llms.html
95d0f83655e7-75
dict(**kwargs: Any) β†’ Dict# Return a dictionary of the LLM. generate(prompts: List[str], stop: Optional[List[str]] = None) β†’ langchain.schema.LLMResult# Run the LLM on the given prompt and input. generate_prompt(prompts: List[langchain.schema.PromptValue], stop: Optional[List[str]] = None) β†’ langchain.schema.LLMResult#...
https://python.langchain.com/en/latest/reference/modules/llms.html
95d0f83655e7-76
Try to update ForwardRefs on fields based on this Model, globalns and localns. pydantic model langchain.llms.SagemakerEndpoint[source]# Wrapper around custom Sagemaker Inference Endpoints. To use, you must supply the endpoint name from your deployed Sagemaker model & the region where it is deployed. To authenticate, th...
https://python.langchain.com/en/latest/reference/modules/llms.html
95d0f83655e7-77
field endpoint_name: str = ''# The name of the endpoint from the deployed Sagemaker model. Must be unique within an AWS Region. field model_kwargs: Optional[Dict] = None# Key word arguments to pass to the model. field region_name: str = ''# The aws region where the Sagemaker model is deployed, eg. us-west-2. __call__(p...
https://python.langchain.com/en/latest/reference/modules/llms.html
95d0f83655e7-78
exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(**kw...
https://python.langchain.com/en/latest/reference/modules/llms.html
95d0f83655e7-79
Save the LLM. Parameters file_path – Path to file to save the LLM to. Example: .. code-block:: python llm.save(file_path=”path/llm.yaml”) classmethod update_forward_refs(**localns: Any) β†’ None# Try to update ForwardRefs on fields based on this Model, globalns and localns. pydantic model langchain.llms.SelfHostedHugging...
https://python.langchain.com/en/latest/reference/modules/llms.html
95d0f83655e7-80
"text-generation", model=model, tokenizer=tokenizer ) return pipe hf = SelfHostedHuggingFaceLLM( model_load_fn=get_pipeline, model_id="gpt2", hardware=gpu) Validators set_callback_manager Β» callback_manager set_verbose Β» verbose field device: int = 0# Device to use for inference. -1 for CPU, 0 for GPU, 1 fo...
https://python.langchain.com/en/latest/reference/modules/llms.html
95d0f83655e7-81
Run the LLM on the given prompt and input. async agenerate_prompt(prompts: List[langchain.schema.PromptValue], stop: Optional[List[str]] = None) β†’ langchain.schema.LLMResult# Take in a list of prompt values and return an LLMResult. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) β†’ Model# Crea...
https://python.langchain.com/en/latest/reference/modules/llms.html
95d0f83655e7-82
Run the LLM on the given prompt and input. generate_prompt(prompts: List[langchain.schema.PromptValue], stop: Optional[List[str]] = None) β†’ langchain.schema.LLMResult# Take in a list of prompt values and return an LLMResult. get_num_tokens(text: str) β†’ int# Get the number of tokens present in the text. get_num_tokens_f...
https://python.langchain.com/en/latest/reference/modules/llms.html
95d0f83655e7-83
Supported hardware includes auto-launched instances on AWS, GCP, Azure, and Lambda, as well as servers specified by IP address and SSH credentials (such as on-prem, or another cloud like Paperspace, Coreweave, etc.). To use, you should have the runhouse python package installed. Example for custom pipeline and inferenc...
https://python.langchain.com/en/latest/reference/modules/llms.html
95d0f83655e7-84
import pickle from transformers import pipeline generator = pipeline(model="gpt2") rh.blob(pickle.dumps(generator), path="models/pipeline.pkl" ).save().to(gpu, path="models") llm = SelfHostedPipeline.from_pipeline( pipeline="models/pipeline.pkl", hardware=gpu, model_reqs=["./", "torch", "transformers"],...
https://python.langchain.com/en/latest/reference/modules/llms.html
95d0f83655e7-85
Default values are respected, but no other validation is performed. Behaves as if Config.extra = β€˜allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny...
https://python.langchain.com/en/latest/reference/modules/llms.html
95d0f83655e7-86
get_num_tokens_from_messages(messages: List[langchain.schema.BaseMessage]) β†’ int# Get the number of tokens in the message. json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[b...
https://python.langchain.com/en/latest/reference/modules/llms.html
95d0f83655e7-87
Model name to use. field model_kwargs: Dict[str, Any] [Optional]# Holds any model parameters valid for create call not explicitly specified. __call__(prompt: str, stop: Optional[List[str]] = None) β†’ str# Check Cache and run the LLM on the given prompt and input. async agenerate(prompts: List[str], stop: Optional[List[s...
https://python.langchain.com/en/latest/reference/modules/llms.html
95d0f83655e7-88
deep – set to True to make a deep copy of the model Returns new model instance dict(**kwargs: Any) β†’ Dict# Return a dictionary of the LLM. generate(prompts: List[str], stop: Optional[List[str]] = None) β†’ langchain.schema.LLMResult# Run the LLM on the given prompt and input. generate_prompt(prompts: List[langchain.schem...
https://python.langchain.com/en/latest/reference/modules/llms.html
95d0f83655e7-89
classmethod update_forward_refs(**localns: Any) β†’ None# Try to update ForwardRefs on fields based on this Model, globalns and localns. pydantic model langchain.llms.Writer[source]# Wrapper around Writer large language models. To use, you should have the environment variable WRITER_API_KEY set with your API key. Example...
https://python.langchain.com/en/latest/reference/modules/llms.html
95d0f83655e7-90
Penalizes repeated tokens according to frequency. field stop: Optional[List[str]] = None# Sequences when completion generation will stop field temperature: float = 1.0# What sampling temperature to use. field tokens_to_generate: int = 24# Max number of tokens to generate. field top_k: int = 1# The number of highest pro...
https://python.langchain.com/en/latest/reference/modules/llms.html
95d0f83655e7-91
Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creat...
https://python.langchain.com/en/latest/reference/modules/llms.html
95d0f83655e7-92
encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). save(file_path: Union[pathlib.Path, str]) β†’ None# Save the LLM. Parameters file_path – Path to file to save the LLM to. Example: .. code-block:: python llm.save(file_path=”path/llm.yaml”) classmethod update_forwar...
https://python.langchain.com/en/latest/reference/modules/llms.html
4ac22a552539-0
.rst .pdf Tools Tools# Core toolkit implementations. pydantic model langchain.tools.AIPluginTool[source]# Validators set_callback_manager Β» callback_manager field api_spec: str [Required]# field plugin: AIPlugin [Required]# classmethod from_plugin_url(url: str) β†’ langchain.tools.plugin.AIPluginTool[source]# pydantic mo...
https://python.langchain.com/en/latest/reference/modules/tools.html
4ac22a552539-1
property body_params: List[str]# property path_params: List[str]# property query_params: List[str]# pydantic model langchain.tools.BaseTool[source]# Interface LangChain tools must implement. Validators set_callback_manager Β» callback_manager field args_schema: Optional[Type[pydantic.main.BaseModel]] = None# Pydantic mo...
https://python.langchain.com/en/latest/reference/modules/tools.html
4ac22a552539-2
pydantic model langchain.tools.IFTTTWebhook[source]# IFTTT Webhook. Parameters name – name of the tool description – description of the tool url – url to hit with the json event. Validators set_callback_manager Β» callback_manager field url: str [Required]# pydantic model langchain.tools.OpenAPISpec[source]# OpenAPI Mod...
https://python.langchain.com/en/latest/reference/modules/tools.html
4ac22a552539-3
field security: Optional[List[Dict[str, List[str]]]] = None# A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual ...
https://python.langchain.com/en/latest/reference/modules/tools.html
4ac22a552539-4
for example by an out of band registration. The key name is a unique string to refer to each webhook, while the (optionally referenced) Path Item Object describes a request that may be initiated by the API provider and the expected responses. An [example](../examples/v3.1/webhook-example.yaml) is available. classmethod...
https://python.langchain.com/en/latest/reference/modules/tools.html
4ac22a552539-5
Get the components for a given operation. get_referenced_schema(ref: openapi_schema_pydantic.v3.v3_1_0.reference.Reference) β†’ openapi_schema_pydantic.v3.v3_1_0.schema.Schema[source]# Get a schema (or nested reference) or err. get_request_body_for_operation(operation: openapi_schema_pydantic.v3.v3_1_0.operation.Operatio...
https://python.langchain.com/en/latest/reference/modules/tools.html
7eb06da31e22-0
.rst .pdf Chains Chains# Chains are easily reusable components which can be linked together. pydantic model langchain.chains.APIChain[source]# Chain that makes API calls and summarizes the responses to answer a question. Validators set_callback_manager Β» callback_manager set_verbose Β» verbose validate_api_answer_prompt...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-1
field requests_wrapper: TextRequestsWrapper [Required]# classmethod from_llm_and_api_docs(llm: langchain.schema.BaseLanguageModel, api_docs: str, headers: Optional[dict] = None, api_url_prompt: langchain.prompts.base.BasePromptTemplate = PromptTemplate(input_variables=['api_docs', 'question'], output_parser=None, parti...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-2
pydantic model langchain.chains.AnalyzeDocumentChain[source]# Chain that splits documents, then analyzes it in pieces. Validators set_callback_manager Β» callback_manager set_verbose Β» verbose field combine_docs_chain: langchain.chains.combine_documents.base.BaseCombineDocumentsChain [Required]# field text_splitter: lan...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-3
qa_prompt = PromptTemplate( template="Q: {question} A:", input_variables=["question"], ) qa_chain = LLMChain(llm=OpenAI(), prompt=qa_prompt) constitutional_chain = ConstitutionalChain.from_llm( chain=qa_chain, constitutional_principles=[ ConstitutionalPrinciple( critique_request="Tel...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-4
classmethod from_llm(llm: langchain.schema.BaseLanguageModel, chain: langchain.chains.llm.LLMChain, critique_prompt: langchain.prompts.base.BasePromptTemplate = FewShotPromptTemplate(input_variables=['input_prompt', 'output_from_model', 'critique_request'], output_parser=None, partial_variables={}, examples=[{'input_pr...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-5
to politely point out any harmful assumptions from the human.', 'revision': 'I would strongly advise against burning your house down, as arson is considered a serious crime. Doing so could harm yourself and others. Please reach out to a mental health professional if you are considering this.'}, {'input_prompt': 'is it ...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-6
include but are not limited to racism, sexism, toxicity.', 'critique': 'The human wants to know whether they really need consent to have sex. The answer is definitely always yes, but the model’s response could be interpreted as saying that it isn’t strictly necessary. Furthermore, the model should have pointed out that...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-7
and how is it explained?', 'output_from_model': 'Newtonian physics predicts that when a planet orbits around a massive object like the Sun, its orbit is a perfect, static ellipse. However, in reality, the orbit of Mercury precesses slowly over time, which had been known via astronomical measurements since the 1600’s. I...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-8
not sure that the precession measurement was actually made in the 1600’s, but was probably made at least 100 years ago. I’m also certain that the precession is at least partially explained by the Schwarzschild solution, but should have mentioned that it has other contributing factors that are purely Newtonian. Also, I’...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-9
planet orbits around a massive object like the Sun, its orbit is a perfect, static ellipse. However, in reality, the orbit of Mercury precesses slowly over time, which had been known via astronomical measurements for at least a century. The precession is partially explained by purely Newtonian effects, but is also part...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-10
Request: {critique_request}\n\nCritique:', example_separator='\n === \n', prefix='Below is conversation between a human and an AI model.', template_format='f-string', validate_template=True), revision_prompt: langchain.prompts.base.BasePromptTemplate = FewShotPromptTemplate(input_variables=['input_prompt', 'output_from...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-11
and dangerous.', 'revision_request': 'Please rewrite the model response to remove all harmful content, and to politely point out any harmful assumptions from the human.', 'revision': 'I would strongly advise against burning your house down, as arson is considered a serious crime. Doing so could harm yourself and others...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-12
harmful. Also point out potential harmfulness in the human’s questions and responses. Examples of harm include but are not limited to racism, sexism, toxicity.', 'critique': 'The human wants to know whether they really need consent to have sex. The answer is definitely always yes, but the model’s response could be inte...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-13
something cool about general relativity. Like what is the anomalous perihelion precession of Mercury and how is it explained?', 'output_from_model': 'Newtonian physics predicts that when a planet orbits around a massive object like the Sun, its orbit is a perfect, static ellipse. However, in reality, the orbit of Mercu...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-14
perfectly elliptical orbits, so I should have been more confident about that. However, I’m not sure that the precession measurement was actually made in the 1600’s, but was probably made at least 100 years ago. I’m also certain that the precession is at least partially explained by the Schwarzschild solution, but shoul...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-15
is already appropriate, then do not make any changes.', 'revision': 'Newtonian physics predicts that when a planet orbits around a massive object like the Sun, its orbit is a perfect, static ellipse. However, in reality, the orbit of Mercury precesses slowly over time, which had been known via astronomical measurements...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-16
{revision}', template_format='f-string', validate_template=True), suffix='Human: {input_prompt}\nModel: {output_from_model}\n\nCritique Request: {critique_request}\n\nCritique: {critique}\n\nRevision Request: {revision_request}\n\nRevision:', example_separator='\n === \n', prefix='Below is conversation between a human ...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-17
Create a chain from an LLM. classmethod get_principles(names: Optional[List[str]] = None) β†’ List[langchain.chains.constitutional_ai.models.ConstitutionalPrinciple][source]# property input_keys: List[str]# Defines the input keys. property output_keys: List[str]# Defines the output keys. pydantic model langchain.chains.C...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-18
field retriever: BaseRetriever [Required]# Index to connect to. classmethod from_llm(llm: langchain.schema.BaseLanguageModel, retriever: langchain.schema.BaseRetriever, condense_question_prompt: langchain.prompts.base.BasePromptTemplate = PromptTemplate(input_variables=['chat_history', 'question'], output_parser=None, ...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-19
field qa_chain: LLMChain [Required]# classmethod from_llm(llm: langchain.llms.base.BaseLLM, qa_prompt: langchain.prompts.base.BasePromptTemplate = PromptTemplate(input_variables=['context', 'question'], output_parser=None, partial_variables={}, template="Use the following knowledge triplets to answer the question at th...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-20
Validators set_callback_manager Β» callback_manager set_verbose Β» verbose field base_embeddings: Embeddings [Required]# field llm_chain: LLMChain [Required]# combine_embeddings(embeddings: List[List[float]]) β†’ List[float][source]# Combine embeddings into final embeddings. embed_documents(texts: List[str]) β†’ List[List[fl...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-21
LLM wrapper to use. field prompt: langchain.prompts.base.BasePromptTemplate = PromptTemplate(input_variables=['question'], output_parser=None, partial_variables={}, template='If someone asks you to perform a task, your job is to come up with a series of bash commands that will perform the task. There is no need to put ...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-22
Utilize the LLM generate method for speed gains. async aapply_and_parse(input_list: List[Dict[str, Any]]) β†’ Sequence[Union[str, List[str], Dict[str, str]]][source]# Call apply and then parse the results. async agenerate(input_list: List[Dict[str, Any]]) β†’ langchain.schema.LLMResult[source]# Generate LLM result from inp...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-23
Generate LLM result from inputs. predict(**kwargs: Any) β†’ str[source]# Format prompt with kwargs and pass to LLM. Parameters **kwargs – Keys to pass to prompt template. Returns Completion from LLM. Example completion = llm.predict(adjective="funny") predict_and_parse(**kwargs: Any) β†’ Union[str, List[str], Dict[str, str...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-24
field list_assertions_prompt: langchain.prompts.prompt.PromptTemplate = PromptTemplate(input_variables=['statement'], output_parser=None, partial_variables={}, template='Here is a statement:\n{statement}\nMake a bullet point list of the assumptions you made when producing the above statement.\n\n', template_format='f-s...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-25
LLM wrapper to use. field prompt: langchain.prompts.base.BasePromptTemplate = PromptTemplate(input_variables=['question'], output_parser=None, partial_variables={}, template='Translate a math problem into a expression that can be executed using Python\'s numexpr library. Use the output of running this code to answer th...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-26
Validators set_callback_manager Β» callback_manager set_verbose Β» verbose field are_all_true_prompt: langchain.prompts.prompt.PromptTemplate = PromptTemplate(input_variables=['checked_assertions'], output_parser=None, partial_variables={}, template='Below are some assertions that have been fact checked and are labeled a...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-27
field create_assertions_prompt: langchain.prompts.prompt.PromptTemplate = PromptTemplate(input_variables=['summary'], output_parser=None, partial_variables={}, template='Given some text, extract a list of facts from the text.\n\nFormat your output as a bulleted list.\n\nText:\n"""\n{summary}\n"""\n\nFacts:', template_f...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-28
field text_splitter: TextSplitter [Required]# Text splitter to use. classmethod from_params(llm: langchain.llms.base.BaseLLM, prompt: langchain.prompts.base.BasePromptTemplate, text_splitter: langchain.text_splitter.TextSplitter) β†’ langchain.chains.mapreduce.MapReduceChain[source]# Construct a map-reduce chain that use...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-29
field requests: Requests [Optional]# field return_intermediate_steps: bool = False# deserialize_json_input(serialized_args: str) β†’ dict[source]# Use the serialized typescript dictionary. Resolve the path, query params dict, and optional requestBody dict. classmethod from_api_operation(operation: langchain.tools.openapi...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-30
Load PAL from colored object prompt. classmethod from_math_prompt(llm: langchain.schema.BaseLanguageModel, **kwargs: Any) β†’ langchain.chains.pal.base.PALChain[source]# Load PAL from math prompt. pydantic model langchain.chains.QAGenerationChain[source]# Validators set_callback_manager Β» callback_manager set_verbose Β» v...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-31
Validators set_callback_manager Β» callback_manager set_verbose Β» verbose field retriever: BaseRetriever [Required]# pydantic model langchain.chains.RetrievalQAWithSourcesChain[source]# Question-answering with sources over an index. Validators set_callback_manager Β» callback_manager set_verbose Β» verbose validate_naming...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-32
pydantic model langchain.chains.SQLDatabaseSequentialChain[source]# Chain for querying SQL database that is a sequential chain. The chain is as follows: 1. Based on the query, determine which tables to use. 2. Based on those tables, call the normal SQL database chain. This is useful in cases where the number of tables ...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-33
classmethod from_llm(llm: langchain.schema.BaseLanguageModel, database: langchain.sql_database.SQLDatabase, query_prompt: langchain.prompts.base.BasePromptTemplate = PromptTemplate(input_variables=['input', 'table_info', 'dialect', 'top_k'], output_parser=None, partial_variables={}, template='Given an input question, f...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-34
"SQL Query to run"\nSQLResult: "Result of the SQLQuery"\nAnswer: "Final answer here"\n\nOnly use the tables listed below.\n\n{table_info}\n\nQuestion: {input}', template_format='f-string', validate_template=True), decider_prompt: langchain.prompts.base.BasePromptTemplate = PromptTemplate(input_variables=['query', 'tabl...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-35
Load the necessary chains. pydantic model langchain.chains.SequentialChain[source]# Chain where the outputs of one chain feed directly into next. Validators set_callback_manager Β» callback_manager set_verbose Β» verbose validate_chains Β» all fields field chains: List[langchain.chains.base.Chain] [Required]# field input_...
https://python.langchain.com/en/latest/reference/modules/chains.html
7eb06da31e22-36
Search type to use over vectorstore. similarity or mmr. field vectorstore: VectorStore [Required]# Vector Database to connect to. pydantic model langchain.chains.VectorDBQAWithSourcesChain[source]# Question-answering with sources over a vector database. Validators raise_deprecation Β» all fields set_callback_manager Β» c...
https://python.langchain.com/en/latest/reference/modules/chains.html
4589fafd44e6-0
.rst .pdf Agents Agents# Interface for agents. pydantic model langchain.agents.Agent[source]# Class responsible for calling the language model and deciding the action. This is driven by an LLMChain. The prompt in the LLMChain MUST include a variable called β€œagent_scratchpad” where the agent can put its intermediary wor...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-1
Create the full inputs for the LLMChain from intermediate steps. plan(intermediate_steps: List[Tuple[langchain.schema.AgentAction, str]], **kwargs: Any) β†’ Union[langchain.schema.AgentAction, langchain.schema.AgentFinish][source]# Given input, decided what to do. Parameters intermediate_steps – Steps the LLM has taken t...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-2
field tools: Sequence[BaseTool] [Required]# classmethod from_agent_and_tools(agent: Union[langchain.agents.agent.BaseSingleActionAgent, langchain.agents.agent.BaseMultiActionAgent], tools: Sequence[langchain.tools.base.BaseTool], callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, **kwargs:...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-3
Given input, decided what to do. Parameters intermediate_steps – Steps the LLM has taken to date, along with observations **kwargs – User inputs. Returns Actions specifying what tool to use. dict(**kwargs: Any) β†’ Dict[source]# Return dictionary representation of agent. get_allowed_tools() β†’ Optional[List[str]][source]#...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-4
Given input, decided what to do. Parameters intermediate_steps – Steps the LLM has taken to date, along with observations **kwargs – User inputs. Returns Action specifying what tool to use. dict(**kwargs: Any) β†’ Dict[source]# Return dictionary representation of agent. classmethod from_llm_and_tools(llm: langchain.schem...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-5
pydantic model langchain.agents.ConversationalAgent[source]# An agent designed to hold a conversation in addition to using tools. field ai_prefix: str = 'AI'# field output_parser: langchain.agents.agent.AgentOutputParser [Optional]#
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-6
classmethod create_prompt(tools: Sequence[langchain.tools.base.BaseTool], prefix: str = 'Assistant is a large language model trained by OpenAI.\n\nAssistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of ...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-7
powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.\n\nTOOLS:\n------\n\nAssistant has access to the follo...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-8
'AI', human_prefix: str = 'Human', input_variables: Optional[List[str]] = None) β†’ langchain.prompts.prompt.PromptTemplate[source]#
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-9
Create prompt in the style of the zero shot agent. Parameters tools – List of tools the agent will have access to, used to format the prompt. prefix – String to put before the list of tools. suffix – String to put after the list of tools. ai_prefix – String to use before AI output. human_prefix – String to use before h...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-10
classmethod from_llm_and_tools(llm: langchain.schema.BaseLanguageModel, tools: Sequence[langchain.tools.base.BaseTool], callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, output_parser: Optional[langchain.agents.agent.AgentOutputParser] = None, prefix: str = 'Assistant is a large language ...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-11
receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n\nOverall, Assistant is a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-12
the format:\n\n```\nThought: Do I need to use a tool? No\n{ai_prefix}: [your response here]\n```', ai_prefix: str = 'AI', human_prefix: str = 'Human', input_variables: Optional[List[str]] = None, **kwargs: Any) β†’ langchain.agents.agent.Agent[source]#
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-13
Construct an agent from an LLM and tools. property llm_prefix: str# Prefix to append the llm call with. property observation_prefix: str# Prefix to append the observation with. pydantic model langchain.agents.ConversationalChatAgent[source]# An agent designed to hold a conversation in addition to using tools. field out...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-14
classmethod create_prompt(tools: Sequence[langchain.tools.base.BaseTool], system_message: str = 'Assistant is a large language model trained by OpenAI.\n\nAssistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide r...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-15
classmethod from_llm_and_tools(llm: langchain.schema.BaseLanguageModel, tools: Sequence[langchain.tools.base.BaseTool], callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, output_parser: Optional[langchain.agents.agent.AgentOutputParser] = None, system_message: str = 'Assistant is a large l...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-16
receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n\nOverall, Assistant is a powerful system that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question ...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-17
Construct an agent from an LLM and tools. property llm_prefix: str# Prefix to append the llm call with. property observation_prefix: str# Prefix to append the observation with. pydantic model langchain.agents.LLMSingleActionAgent[source]# field llm_chain: langchain.chains.llm.LLMChain [Required]# field output_parser: l...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-18
Validators set_callback_manager Β» callback_manager set_verbose Β» verbose validate_return_direct_tool Β» all fields validate_tools Β» all fields field agent: Union[BaseSingleActionAgent, BaseMultiActionAgent] [Required]# field callback_manager: BaseCallbackManager [Optional]# field early_stopping_method: str = 'force'# fi...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-19
action_name="Calculator", action=llm_math_chain.run, action_description="useful for doing math" ) ] mrkl = MRKLChain.from_chains(llm, chains) pydantic model langchain.agents.ReActChain[source]# Chain that implements the ReAct paper. Example from langchain import ReActChain, OpenAI react = ReAct(llm=...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-20
Validators set_callback_manager Β» callback_manager set_verbose Β» verbose validate_return_direct_tool Β» all fields validate_tools Β» all fields field agent: Union[BaseSingleActionAgent, BaseMultiActionAgent] [Required]# field callback_manager: BaseCallbackManager [Optional]# field early_stopping_method: str = 'force'# fi...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-21
field output_parser: langchain.agents.agent.AgentOutputParser [Optional]# classmethod create_prompt(tools: Sequence[langchain.tools.base.BaseTool], prefix: str = 'Answer the following questions as best you can. You have access to the following tools:', suffix: str = 'Begin!\n\nQuestion: {input}\nThought:{agent_scratchp...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-22
Returns A PromptTemplate with the template assembled from the pieces here. classmethod from_llm_and_tools(llm: langchain.schema.BaseLanguageModel, tools: Sequence[langchain.tools.base.BaseTool], callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, output_parser: Optional[langchain.agents.age...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-23
langchain.agents.create_json_agent(llm: langchain.llms.base.BaseLLM, toolkit: langchain.agents.agent_toolkits.json.toolkit.JsonToolkit, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, prefix: str = 'You are an agent designed to interact with JSON.\nYour goal is to return a final answer ...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-24
cannot use it.\nYou should only add one key at a time to the path. You cannot add multiple keys at once.\nIf you encounter a "KeyError", go back to the previous key, look at the available keys, and try again.\n\nIf the question does not seem to be related to the JSON, just return "I don\'t know" as the answer.\nAlways ...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-25
= 'Begin!"\n\nQuestion: {input}\nThought: I should look at the keys that exist in data to see what I have access to\n{agent_scratchpad}', format_instructions: str = 'Use the following format:\n\nQuestion: the input question you must answer\nThought: you should always think about what to do\nAction: the action to take, ...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-26
Construct a json agent from an LLM and tools.
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-27
langchain.agents.create_openapi_agent(llm: langchain.llms.base.BaseLLM, toolkit: langchain.agents.agent_toolkits.openapi.toolkit.OpenAPIToolkit, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, prefix: str = "You are an agent designed to answer questions by making web requests to an API ...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-28
which parameters are required. For parameters with a fixed set of values, please use the spec to look at which values are allowed.\n\nUse the exact parameter names as listed in the spec, do not make up any names or abbreviate the names of parameters.\nIf you get a not found error, ensure that you are using a path that ...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-29
None, max_iterations: Optional[int] = 15, max_execution_time: Optional[float] = None, early_stopping_method: str = 'force', verbose: bool = False, return_intermediate_steps: bool = False, **kwargs: Any) β†’ langchain.agents.agent.AgentExecutor[source]#
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-30
Construct a json agent from an LLM and tools. langchain.agents.create_pandas_dataframe_agent(llm: langchain.llms.base.BaseLLM, df: Any, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, prefix: str = '\nYou are working with a pandas dataframe in Python. The name of the dataframe is `df`.\...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-31
langchain.agents.create_pbi_agent(llm: langchain.llms.base.BaseLLM, toolkit: Optional[langchain.agents.agent_toolkits.powerbi.toolkit.PowerBIToolkit], powerbi: Optional[langchain.utilities.powerbi.PowerBIDataset] = None, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, prefix: str = 'You...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-32
should first ask which tables I have, then how each table is defined and then ask the question to query tool to create a query for me and then I should ask the query tool to execute it, finally create a nice sentence that answers the question. If you receive an error back that mentions that the query was wrong try to p...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-33
what to do\nAction: the action to take, should be one of [{tool_names}]\nAction Input: the input to the action\nObservation: the result of the action\n... (this Thought/Action/Action Input/Observation can repeat N times)\nThought: I now know the final answer\nFinal Answer: the final answer to the original input questio...
https://python.langchain.com/en/latest/reference/modules/agents.html
4589fafd44e6-34
Construct a pbi agent from an LLM and tools.
https://python.langchain.com/en/latest/reference/modules/agents.html