id
stringlengths
14
16
text
stringlengths
36
2.73k
source
stringlengths
49
117
2b223368723b-37
Construct a sql agent from an LLM and tools.
https://python.langchain.com/en/latest/reference/modules/agents.html
2b223368723b-38
langchain.agents.create_sql_agent(llm: langchain.base_language.BaseLanguageModel, toolkit: langchain.agents.agent_toolkits.sql.toolkit.SQLDatabaseToolkit, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, prefix: str = 'You are an agent designed to interact with a SQL database.\nGiven an ...
https://python.langchain.com/en/latest/reference/modules/agents.html
2b223368723b-39
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 question', input_variables: Optional[List[str]] = None, top_k...
https://python.langchain.com/en/latest/reference/modules/agents.html
2b223368723b-40
Construct a sql agent from an LLM and tools. langchain.agents.create_vectorstore_agent(llm: langchain.base_language.BaseLanguageModel, toolkit: langchain.agents.agent_toolkits.vectorstore.toolkit.VectorStoreToolkit, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, prefix: str = 'You are ...
https://python.langchain.com/en/latest/reference/modules/agents.html
2b223368723b-41
Construct a vectorstore router agent from an LLM and tools. langchain.agents.get_all_tool_names() → List[str][source]# Get a list of all possible tool names. langchain.agents.initialize_agent(tools: Sequence[langchain.tools.base.BaseTool], llm: langchain.base_language.BaseLanguageModel, agent: Optional[langchain.agents...
https://python.langchain.com/en/latest/reference/modules/agents.html
2b223368723b-42
langchain.agents.load_tools(tool_names: List[str], llm: Optional[langchain.base_language.BaseLanguageModel] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None, **kwargs: Any) → List[langchain.tools.base.BaseTool][source]# Load tool...
https://python.langchain.com/en/latest/reference/modules/agents.html
2b223368723b-43
By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on Jun 11, 2023.
https://python.langchain.com/en/latest/reference/modules/agents.html
ddf0ae931e13-0
.rst .pdf Document Compressors Document Compressors# pydantic model langchain.retrievers.document_compressors.CohereRerank[source]# field client: Client [Required]# field model: str = 'rerank-english-v2.0'# field top_n: int = 3# async acompress_documents(documents: Sequence[langchain.schema.Document], query: str) → Seq...
https://python.langchain.com/en/latest/reference/modules/document_compressors.html
ddf0ae931e13-1
similarity_threshold must be specified. Defaults to 20. field similarity_fn: Callable = <function cosine_similarity># Similarity function for comparing documents. Function expected to take as input two matrices (List[List[float]]) and return a matrix of scores where higher values indicate greater similarity. field simi...
https://python.langchain.com/en/latest/reference/modules/document_compressors.html
ddf0ae931e13-2
Compress page content of raw documents. classmethod from_llm(llm: langchain.base_language.BaseLanguageModel, prompt: Optional[langchain.prompts.prompt.PromptTemplate] = None, get_input: Optional[Callable[[str, langchain.schema.Document], str]] = None, llm_chain_kwargs: Optional[dict] = None) → langchain.retrievers.docu...
https://python.langchain.com/en/latest/reference/modules/document_compressors.html
49017d91b4bb-0
.rst .pdf Tools Tools# Core toolkit implementations. pydantic model langchain.tools.AIPluginTool[source]# field api_spec: str [Required]# field args_schema: Type[AIPluginToolSchema] = <class 'langchain.tools.plugin.AIPluginToolSchema'># Pydantic model class to validate and parse the tool’s input arguments. field plugin...
https://python.langchain.com/en/latest/reference/modules/tools.html
49017d91b4bb-1
to_typescript() → str[source]# Get typescript string representation of the operation. static ts_type_from_python(type_: Union[str, Type, tuple, None, enum.Enum]) → str[source]# property body_params: List[str]# property path_params: List[str]# property query_params: List[str]# pydantic model langchain.tools.AzureCogsFor...
https://python.langchain.com/en/latest/reference/modules/tools.html
49017d91b4bb-2
Interface LangChain tools must implement. field args_schema: Optional[Type[pydantic.main.BaseModel]] = None# Pydantic model class to validate and parse the tool’s input arguments. field callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None# Deprecated. Please use callbacks instead. field callb...
https://python.langchain.com/en/latest/reference/modules/tools.html
49017d91b4bb-3
Run the tool asynchronously. run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None, **kwargs: Any) → Any[s...
https://python.langchain.com/en/latest/reference/modules/tools.html
49017d91b4bb-4
field name: str = 'click_element'# The unique name of the tool that clearly communicates its purpose. field playwright_strict: bool = False# Whether to employ Playwright’s strict mode when clicking on elements. field playwright_timeout: float = 1000# Timeout (in ms) for Playwright to wait for element to be ready. field...
https://python.langchain.com/en/latest/reference/modules/tools.html
49017d91b4bb-5
Pydantic model class to validate and parse the tool’s input arguments. field description: str = 'Delete a file'# Used to tell the model how/when/why to use the tool. You can provide few-shot examples as a part of the description. field name: str = 'file_delete'# The unique name of the tool that clearly communicates its...
https://python.langchain.com/en/latest/reference/modules/tools.html
49017d91b4bb-6
pydantic model langchain.tools.ExtractTextTool[source]# field args_schema: Type[BaseModel] = <class 'pydantic.main.BaseModel'># Pydantic model class to validate and parse the tool’s input arguments. field description: str = 'Extract all the text on the current webpage'# Used to tell the model how/when/why to use the to...
https://python.langchain.com/en/latest/reference/modules/tools.html
49017d91b4bb-7
The unique name of the tool that clearly communicates its purpose. pydantic model langchain.tools.GmailCreateDraft[source]# field args_schema: Type[langchain.tools.gmail.create_draft.CreateDraftSchema] = <class 'langchain.tools.gmail.create_draft.CreateDraftSchema'># Pydantic model class to validate and parse the tool’...
https://python.langchain.com/en/latest/reference/modules/tools.html
49017d91b4bb-8
Pydantic model class to validate and parse the tool’s input arguments. field description: str = 'Use this tool to search for email messages. The input must be a valid Gmail query. The output is a JSON list of messages.'# Used to tell the model how/when/why to use the tool. You can provide few-shot examples as a part of...
https://python.langchain.com/en/latest/reference/modules/tools.html
49017d91b4bb-9
field api_wrapper: langchain.utilities.google_places_api.GooglePlacesAPIWrapper [Optional]# field args_schema: Type[pydantic.main.BaseModel] = <class 'langchain.tools.google_places.tool.GooglePlacesSchema'># Pydantic model class to validate and parse the tool’s input arguments. pydantic model langchain.tools.GoogleSear...
https://python.langchain.com/en/latest/reference/modules/tools.html
49017d91b4bb-10
pydantic model langchain.tools.InfoPowerBITool[source]# Tool for getting metadata about a PowerBI Dataset. field powerbi: langchain.utilities.powerbi.PowerBIDataset [Required]# pydantic model langchain.tools.ListDirectoryTool[source]# field args_schema: Type[pydantic.main.BaseModel] = <class 'langchain.tools.file_manag...
https://python.langchain.com/en/latest/reference/modules/tools.html
49017d91b4bb-11
field name: str = 'move_file'# The unique name of the tool that clearly communicates its purpose. pydantic model langchain.tools.NavigateBackTool[source]# Navigate back to the previous page in the browser history. field args_schema: Type[BaseModel] = <class 'pydantic.main.BaseModel'># Pydantic model class to validate a...
https://python.langchain.com/en/latest/reference/modules/tools.html
49017d91b4bb-12
Get an OpenAPI spec from a dict. classmethod from_text(text: str) → langchain.tools.openapi.utils.openapi_utils.OpenAPISpec[source]# Get an OpenAPI spec from a text. classmethod from_url(url: str) → langchain.tools.openapi.utils.openapi_utils.OpenAPISpec[source]# Get an OpenAPI spec from a URL. static get_cleaned_opera...
https://python.langchain.com/en/latest/reference/modules/tools.html
49017d91b4bb-13
property base_url: str# Get the base url. pydantic model langchain.tools.OpenWeatherMapQueryRun[source]# Tool that adds the capability to query using the OpenWeatherMap API. field api_wrapper: langchain.utilities.openweathermap.OpenWeatherMapAPIWrapper [Optional]# pydantic model langchain.tools.PubmedQueryRun[source]# ...
https://python.langchain.com/en/latest/reference/modules/tools.html
49017d91b4bb-14
field template: Optional[str] = '\nAnswer the question below with a DAX query that can be sent to Power BI. DAX queries have a simple syntax comprised of just one required keyword, EVALUATE, and several optional keywords: ORDER BY, START AT, DEFINE, MEASURE, VAR, TABLE, and COLUMN. Each keyword defines a statement used...
https://python.langchain.com/en/latest/reference/modules/tools.html
49017d91b4bb-15
ORDER BY <expression> ASC or DESC START AT <value> or <parameter> - The optional START AT keyword is used inside an ORDER BY clause. It defines the value at which the query results begin.\nDEFINE MEASURE | VAR; EVALUATE <table> - The optional DEFINE keyword introduces one or more calculated entity definitions that exis...
https://python.langchain.com/en/latest/reference/modules/tools.html
49017d91b4bb-16
you nest the DISTINCT function within a formula, to get a list of distinct values that can be passed to another function and then counted, summed, or used for other operations.\nDISTINCT(<table>) - Returns a table by removing duplicate rows from another table or expression.\n\nAggregation functions, names with a A in i...
https://python.langchain.com/en/latest/reference/modules/tools.html
49017d91b4bb-17
date2, <interval>) - Returns the difference between two date values, in the specified interval, that can be SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, YEAR.\nDATEVALUE(<date_text>) - Returns a date value that represents the specified date.\nYEAR(<date>), QUARTER(<date>), MONTH(<date>), DAY(<date>), HOUR(<date>), ...
https://python.langchain.com/en/latest/reference/modules/tools.html
49017d91b4bb-18
pydantic model langchain.tools.ReadFileTool[source]# field args_schema: Type[pydantic.main.BaseModel] = <class 'langchain.tools.file_management.read.ReadFileInput'># Pydantic model class to validate and parse the tool’s input arguments. field description: str = 'Read file from disk'# Used to tell the model how/when/why...
https://python.langchain.com/en/latest/reference/modules/tools.html
49017d91b4bb-19
The input arguments’ schema. The tool schema. field coroutine: Optional[Callable[[...], Awaitable[Any]]] = None# The asynchronous version of the function. field description: str = ''# Used to tell the model how/when/why to use the tool. You can provide few-shot examples as a part of the description. field func: Callabl...
https://python.langchain.com/en/latest/reference/modules/tools.html
49017d91b4bb-20
The function to run when the tool is called. field handle_tool_error: Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]] = False# Handle the content of the ToolException thrown. field name: str [Required]# The unique name of the tool that clearly communicates its purpose. field return_direc...
https://python.langchain.com/en/latest/reference/modules/tools.html
49017d91b4bb-21
pydantic model langchain.tools.WriteFileTool[source]# field args_schema: Type[pydantic.main.BaseModel] = <class 'langchain.tools.file_management.write.WriteFileInput'># Pydantic model class to validate and parse the tool’s input arguments. field description: str = 'Write file to disk'# Used to tell the model how/when/w...
https://python.langchain.com/en/latest/reference/modules/tools.html
49017d91b4bb-22
your exposed actions here: https://nla.zapier.com/demo/start/ The return JSON is guaranteed to be less than ~500 words (350 tokens) making it safe to inject into the prompt of another LLM call. Parameters action_id – a specific action ID (from list actions) of the action to execute (the set api_key must be associated w...
https://python.langchain.com/en/latest/reference/modules/tools.html
49017d91b4bb-23
field base_prompt: str = 'A wrapper around Zapier NLA actions. The input to this tool is a natural language instruction, for example "get the latest email from my bank" or "send a slack message to the #general channel". Each tool will have params associated with it that are specified as a list. You MUST take into accou...
https://python.langchain.com/en/latest/reference/modules/tools.html
49017d91b4bb-24
infer_schema – Whether to infer the schema of the arguments from the function’s signature. This also makes the resultant tool accept a dictionary input to its run() function. Requires: Function must be of type (str) -> str Function must have a docstring Examples @tool def search_api(query: str) -> str: # Searches t...
https://python.langchain.com/en/latest/reference/modules/tools.html
2aa15396c9dd-0
.rst .pdf LLMs LLMs# Wrappers on top of large language models APIs. pydantic model langchain.llms.AI21[source]# Wrapper around AI21 large language models. To use, you should have the environment variable AI21_API_KEY set with your API key. Example from langchain.llms import AI21 ai21 = AI21(model="j2-jumbo-instruct") V...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-1
How many completions to generate for each prompt. field presencePenalty: langchain.llms.ai21.AI21PenaltyData = AI21PenaltyData(scale=0, applyToWhitespaces=True, applyToPunctuations=True, applyToNumbers=True, applyToStopwords=True, applyToEmojis=True)# Penalizes repeated tokens. field temperature: float = 0.7# What samp...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-2
Predict message from messages. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model# 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 ...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-3
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_from_messages(messages: List[langchain.schema.BaseMessage]) → int# Get the number of tokens in the message. get_token_ids(text: str) → List[int]# Get the token present i...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-4
Try to update ForwardRefs on fields based on this Model, globalns and localns. pydantic model langchain.llms.AlephAlpha[source]# Wrapper around Aleph Alpha large language models. To use, you should have the aleph_alpha_client python package installed, and the environment variable ALEPH_ALPHA_API_KEY set with your API k...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-5
field log_probs: Optional[int] = None# Number of top log probabilities to be returned for each generated token. field logit_bias: Optional[Dict[int, float]] = None# The logit bias allows to influence the likelihood of generating tokens. field maximum_tokens: int = 64# The maximum number of tokens to be generated. field...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-6
Number of most likely tokens to consider at each step. field top_p: float = 0.0# Total probability mass of tokens to consider at each step. field use_multiplicative_presence_penalty: Optional[bool] = False# Flag deciding whether presence penalty is applied multiplicatively (True) or additively (False). field verbose: b...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-7
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
2aa15396c9dd-8
Get the number of tokens present in the text. get_num_tokens_from_messages(messages: List[langchain.schema.BaseMessage]) → int# Get the number of tokens in the message. get_token_ids(text: str) → List[int]# Get the token present in the text. json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, ...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-9
Wrapper around Anthropic’s large language models. To use, you should have the anthropic python package installed, and the environment variable ANTHROPIC_API_KEY set with your API key, or pass it as a named parameter to the constructor. Example import anthropic from langchain.llms import Anthropic model = Anthropic(mode...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-10
field verbose: bool [Optional]# Whether to print out response text. __call__(prompt: str, stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None) → str# Check Cache and run the LLM on the given prompt and inpu...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-11
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] = None, deep: bool = False) → Model# Duplicate a model, optionally...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-12
get_token_ids(text: str) → List[int]# Get the token present in the text. 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_...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-13
Returns A generator representing the stream of tokens from Anthropic. Example prompt = "Write a poem about a stream." prompt = f"\n\nHuman: {prompt}\n\nAssistant:" generator = anthropic.stream(prompt) for token in generator: yield token classmethod update_forward_refs(**localns: Any) → None# Try to update ForwardRe...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-14
Check Cache and run the LLM on the given prompt and input. async agenerate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None) → langchain.schema.LLMResult# Run the LLM on the given pro...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-15
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 creating the new model: you should trust this data deep – set to True to make a deep co...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-16
Get the token present in the text. 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_none: ...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-17
directly. To get a list of the models supported on an aviary, follow the instructions on the web site to install the aviary CLI and then use: aviary models You must at least specify the environment variable or parameter AVIARY_URL. You may optionally specify the environment variable or parameter AVIARY_TOKEN. Example f...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-18
Predict text from text. async apredict_messages(messages: List[langchain.schema.BaseMessage], *, stop: Optional[Sequence[str]] = None) → langchain.schema.BaseMessage# Predict message from messages. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model# Creates a new model setting __dict__ a...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-19
Run the LLM on the given prompt and input. generate_prompt(prompts: List[langchain.schema.PromptValue], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None) → langchain.schema.LLMResult# Take in a list of p...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-20
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.AzureOpenAI[sourc...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-21
Adjust the probability of specific tokens being generated. field max_retries: int = 6# Maximum number of retries to make when generating. field max_tokens: int = 256# The maximum number of tokens to generate in the completion. -1 returns as many tokens as possible given the prompt and the models maximal context size. f...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-22
Run the LLM on the given prompt and input. async agenerate_prompt(prompts: List[langchain.schema.PromptValue], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None) → langchain.schema.LLMResult# Take in a li...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-23
deep – set to True to make a deep copy of the model Returns new model instance create_llm_result(choices: Any, prompts: List[str], token_usage: Dict[str, int]) → langchain.schema.LLMResult# Create the LLMResult from the choices and prompts. dict(**kwargs: Any) → Dict# Return a dictionary of the LLM. generate(prompts: L...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-24
Get the token IDs using the tiktoken package. 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, exc...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-25
Prepare the params for streaming. 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”) stream(prompt: str, stop: Optional[List[str]] = None) → Generator# Call OpenAI with streaming flag...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-26
explicitly specified. field verbose: bool [Optional]# Whether to print out response text. __call__(prompt: str, stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None) → str# Check Cache and run the LLM on the...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-27
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] = None, deep: bool = False) → Model# Duplicate a model, optionally...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-28
get_token_ids(text: str) → List[int]# Get the token present in the text. 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_...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-29
The required model param can be either a model id or model version id. Using a model version ID will result in slightly faster invocation. Any other model parameters can also be passed in with the format input={model_param: value, …} The Baseten model must accept a dictionary of input with the key “prompt” and return a...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-30
Predict message from messages. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model# 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 ...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-31
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_from_messages(messages: List[langchain.schema.BaseMessage]) → int# Get the number of tokens in the message. get_token_ids(text: str) → List[int]# Get the token present i...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-32
Try to update ForwardRefs on fields based on this Model, globalns and localns. pydantic model langchain.llms.Beam[source]# Wrapper around Beam API for gpt2 large language model. To use, you should have the beam-sdk python package installed, and the environment variable BEAM_CLIENT_ID set with your client id and BEAM_CL...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-33
field verbose: bool [Optional]# Whether to print out response text. __call__(prompt: str, stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None) → str# Check Cache and run the LLM on the given prompt and inpu...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-34
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] = None, deep: bool = False) → Model# Duplicate a model, optionally...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-35
get_token_ids(text: str) → List[int]# Get the token present in the text. 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_...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-36
To authenticate, the AWS client uses the following methods to automatically load credentials: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html If a specific credential profile should be used, you must pass the name of the profile from the ~/.aws/credentials file that is to be used. Make su...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-37
Check Cache and run the LLM on the given prompt and input. async agenerate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None) → langchain.schema.LLMResult# Run the LLM on the given pro...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-38
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 creating the new model: you should trust this data deep – set to True to make a deep co...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-39
Get the token present in the text. 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_none: ...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-40
Example from langchain.llms import CTransformers llm = CTransformers(model="/path/to/ggml-gpt-2.bin", model_type="gpt2") Validators raise_deprecation » all fields set_verbose » verbose validate_environment » all fields field config: Optional[Dict[str, Any]] = None# The config parameters. See marella/ctransformers field...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-41
Take in a list of prompt values and return an LLMResult. async apredict(text: str, *, stop: Optional[Sequence[str]] = None) → str# Predict text from text. async apredict_messages(messages: List[langchain.schema.BaseMessage], *, stop: Optional[Sequence[str]] = None) → langchain.schema.BaseMessage# Predict message from m...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-42
Run the LLM on the given prompt and input. generate_prompt(prompts: List[langchain.schema.PromptValue], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None) → langchain.schema.LLMResult# Take in a list of p...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-43
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.CerebriumAI[sourc...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-44
Run the LLM on the given prompt and input. async agenerate_prompt(prompts: List[langchain.schema.PromptValue], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None) → langchain.schema.LLMResult# Take in a li...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-45
Returns new model instance dict(**kwargs: Any) → Dict# Return a dictionary of the LLM. generate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None) → langchain.schema.LLMResult# Run the...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-46
predict(text: str, *, stop: Optional[Sequence[str]] = None) → str# Predict text from text. predict_messages(messages: List[langchain.schema.BaseMessage], *, stop: Optional[Sequence[str]] = None) → langchain.schema.BaseMessage# Predict message from messages. save(file_path: Union[pathlib.Path, str]) → None# Save the LLM...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-47
Model name to use. field p: int = 1# Total probability mass of tokens to consider at each step. field presence_penalty: float = 0.0# Penalizes repeated tokens. Between 0 and 1. field temperature: float = 0.75# A non-negative float that tunes the degree of randomness in generation. field truncate: Optional[str] = None# ...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-48
Predict message from messages. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model# 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 ...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-49
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_from_messages(messages: List[langchain.schema.BaseMessage]) → int# Get the number of tokens in the message. get_token_ids(text: str) → List[int]# Get the token present i...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-50
Try to update ForwardRefs on fields based on this Model, globalns and localns. pydantic model langchain.llms.Databricks[source]# LLM wrapper around a Databricks serving endpoint or a cluster driver proxy app. It supports two endpoint types: Serving endpoint (recommended for both production and development). We assume t...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-51
If the endpoint model signature is different or you want to set extra params, you can use transform_input_fn and transform_output_fn to apply necessary transformations before and after the query. Validators raise_deprecation » all fields set_cluster_driver_port » cluster_driver_port set_cluster_id » cluster_id set_mode...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-52
the DATABRICKS_HOST environment variable if present, or the hostname of the current Databricks workspace if running inside a Databricks notebook attached to an interactive cluster in “single user” or “no isolation shared” mode. field model_kwargs: Optional[Dict[str, Any]] = None# Extra parameters to pass to the endpoin...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-53
Take in a list of prompt values and return an LLMResult. async apredict(text: str, *, stop: Optional[Sequence[str]] = None) → str# Predict text from text. async apredict_messages(messages: List[langchain.schema.BaseMessage], *, stop: Optional[Sequence[str]] = None) → langchain.schema.BaseMessage# Predict message from m...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-54
Run the LLM on the given prompt and input. generate_prompt(prompts: List[langchain.schema.PromptValue], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None) → langchain.schema.LLMResult# Take in a list of p...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-55
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.DeepInfra[source]...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-56
Run the LLM on the given prompt and input. async agenerate_prompt(prompts: List[langchain.schema.PromptValue], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None) → langchain.schema.LLMResult# Take in a li...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-57
Returns new model instance dict(**kwargs: Any) → Dict# Return a dictionary of the LLM. generate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None) → langchain.schema.LLMResult# Run the...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-58
predict(text: str, *, stop: Optional[Sequence[str]] = None) → str# Predict text from text. predict_messages(messages: List[langchain.schema.BaseMessage], *, stop: Optional[Sequence[str]] = None) → langchain.schema.BaseMessage# Predict message from messages. save(file_path: Union[pathlib.Path, str]) → None# Save the LLM...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-59
Take in a list of prompt values and return an LLMResult. async apredict(text: str, *, stop: Optional[Sequence[str]] = None) → str# Predict text from text. async apredict_messages(messages: List[langchain.schema.BaseMessage], *, stop: Optional[Sequence[str]] = None) → langchain.schema.BaseMessage# Predict message from m...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-60
Run the LLM on the given prompt and input. generate_prompt(prompts: List[langchain.schema.PromptValue], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None) → langchain.schema.LLMResult# Take in a list of p...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-61
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.ForefrontAI[sourc...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-62
Check Cache and run the LLM on the given prompt and input. async agenerate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None) → langchain.schema.LLMResult# Run the LLM on the given pro...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-63
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 creating the new model: you should trust this data deep – set to True to make a deep co...
https://python.langchain.com/en/latest/reference/modules/llms.html
2aa15396c9dd-64
Get the token present in the text. 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_none: ...
https://python.langchain.com/en/latest/reference/modules/llms.html