id
stringlengths
14
16
text
stringlengths
4
1.28k
source
stringlengths
54
121
0e0436a883fe-311
Model dict(**kwargs) Return a dictionary of the LLM. Parameters kwargs (Any) – Return type Dict generate(prompts, stop=None, callbacks=None, *, tags=None, **kwargs) Run the LLM on the given prompt and input. Parameters prompts (List[str]) – stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.call...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-312
stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – kwargs (Any) – Return type langchain.schema.LLMResult get_num_tokens(text) Get the number of tokens present in the text. Parameters text (str) – Return type i...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-313
Return type List[int] json(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=None, models_as_dict=True, **dumps_kwargs) Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optio...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-314
models_as_dict (bool) – dumps_kwargs (Any) – Return type unicode predict(text, *, stop=None, **kwargs) Predict text from text. Parameters text (str) – stop (Optional[Sequence[str]]) – kwargs (Any) – Return type str predict_messages(messages, *, stop=None, **kwargs) Predict message from messages. Parameters messa...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-315
classmethod update_forward_refs(**localns) Try to update ForwardRefs on fields based on this Model, globalns and localns. Parameters localns (Any) – Return type None property lc_attributes: Dict Return a list of attribute names that should be included in the serialized kwargs. These attributes must be accepted by th...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-316
class langchain.llms.HumanInputLLM(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, input_func=None, prompt_func=None, separator='\n', input_kwargs={}, prompt_kwargs={})[source] Bases: langchain.llms.base.LLM A LLM wrapper which returns user input as the response. Parameters cache (Option...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-317
Return type None attribute tags: Optional[List[str]] = None Tags to add to the run trace. attribute verbose: bool [Optional] Whether to print out response text. __call__(prompt, stop=None, callbacks=None, **kwargs) Check Cache and run the LLM on the given prompt and input. Parameters prompt (str) – stop (Optional[L...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-318
stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – tags (Optional[List[str]]) – kwargs (Any) – Return type langchain.schema.LLMResult async agenerate_prompt(prompts, stop=None, callbacks=None, **kwargs) Take i...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-319
Parameters text (str) – stop (Optional[Sequence[str]]) – kwargs (Any) – Return type str async apredict_messages(messages, *, stop=None, **kwargs) Predict message from messages. Parameters messages (List[langchain.schema.BaseMessage]) – stop (Optional[Sequence[str]]) – kwargs (Any) – Return type langchain.schema....
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-320
Return type Model copy(*, include=None, exclude=None, update=None, deep=False) Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to include in new model exclude (Optional[Union[AbstractSetIntStr, MappingI...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-321
kwargs (Any) – Return type Dict generate(prompts, stop=None, callbacks=None, *, tags=None, **kwargs) Run the LLM on the given prompt and input. Parameters prompts (List[str]) – stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCal...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-322
kwargs (Any) – Return type langchain.schema.LLMResult get_num_tokens(text) Get the number of tokens present in the text. Parameters text (str) – Return type int get_num_tokens_from_messages(messages) Get the number of tokens in the message. Parameters messages (List[langchain.schema.BaseMessage]) – Return type int...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-323
encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). Parameters include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – by_alias (bool) – skip_defaults (Optional[bool]) – exclude_unset (bo...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-324
Return type str predict_messages(messages, *, stop=None, **kwargs) Predict message from messages. Parameters messages (List[langchain.schema.BaseMessage]) – stop (Optional[Sequence[str]]) – kwargs (Any) – Return type langchain.schema.BaseMessage save(file_path) Save the LLM. Parameters file_path (Union[pathlib.Pat...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-325
serialized kwargs. These attributes must be accepted by the constructor. property lc_namespace: List[str] Return the namespace of the langchain object. eg. [β€œlangchain”, β€œllms”, β€œopenai”] property lc_secrets: Dict[str, str] Return a map of constructor argument names to secret ids. eg. {β€œopenai_api_key”: β€œOPENAI_API_K...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-326
class langchain.llms.LlamaCpp(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, client=None, model_path, lora_base=None, lora_path=None, n_ctx=512, n_parts=- 1, seed=- 1, f16_kv=True, logits_all=False, vocab_only=False, use_mlock=False, n_threads=None, n_batch=8, n_gpu_layers=None, suffix=N...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-327
path to the Llama model as a named parameter to the constructor. Check out: https://github.com/abetlen/llama-cpp-python Example from langchain.llms import LlamaCppEmbeddings llm = LlamaCppEmbeddings(model_path="/path/to/llama/model") Parameters cache (Optional[bool]) – verbose (bool) – callbacks (Optional[Union[List[...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-328
seed (int) – f16_kv (bool) – logits_all (bool) – vocab_only (bool) – use_mlock (bool) – n_threads (Optional[int]) – n_batch (Optional[int]) – n_gpu_layers (Optional[int]) – suffix (Optional[str]) – max_tokens (Optional[int]) – temperature (Optional[float]) – top_p (Optional[float]) – logprobs (Optional[int]...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-329
Whether to echo the prompt. attribute f16_kv: bool = True Use half-precision for key/value cache. attribute last_n_tokens_size: Optional[int] = 64 The number of tokens to look back when applying the repeat_penalty. attribute logits_all: bool = False Return logits for all tokens, not just the last token. attribute lo...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-330
The maximum number of tokens to generate. attribute model_path: str [Required] The path to the Llama model file. attribute n_batch: Optional[int] = 8 Number of tokens to process in parallel. Should be a number between 1 and n_ctx. attribute n_ctx: int = 512 Token context window. attribute n_gpu_layers: Optional[int]...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-331
The penalty to apply to repeated tokens. attribute seed: int = -1 Seed. If -1, a random seed is used. attribute stop: Optional[List[str]] = [] A list of strings to stop generation when encountered. attribute streaming: bool = True Whether to stream the results, token by token. attribute suffix: Optional[str] = None...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-332
The top-p value to use for sampling. attribute use_mlock: bool = False Force system to keep model in RAM. attribute use_mmap: Optional[bool] = True Whether to keep the model loaded in RAM attribute verbose: bool [Optional] Whether to print out response text. attribute vocab_only: bool = False Only load the vocabula...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-333
Run the LLM on the given prompt and input. Parameters prompts (List[str]) – stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – tags (Optional[List[str]]) – kwargs (Any) – Return type langchain.schema.LLMResult...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-334
Return type langchain.schema.LLMResult async apredict(text, *, stop=None, **kwargs) Predict text from text. Parameters text (str) – stop (Optional[Sequence[str]]) – kwargs (Any) – Return type str async apredict_messages(messages, *, stop=None, **kwargs) Predict message from messages. Parameters messages (List[lang...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-335
Parameters _fields_set (Optional[SetStr]) – values (Any) – Return type Model copy(*, include=None, exclude=None, update=None, deep=False) Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to include in ...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-336
Model dict(**kwargs) Return a dictionary of the LLM. Parameters kwargs (Any) – Return type Dict generate(prompts, stop=None, callbacks=None, *, tags=None, **kwargs) Run the LLM on the given prompt and input. Parameters prompts (List[str]) – stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.call...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-337
stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – kwargs (Any) – Return type langchain.schema.LLMResult get_num_tokens(text)[source] Get the number of tokens present in the text. Parameters text (str) – Retur...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-338
Return type List[int] json(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=None, models_as_dict=True, **dumps_kwargs) Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optio...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-339
models_as_dict (bool) – dumps_kwargs (Any) – Return type unicode predict(text, *, stop=None, **kwargs) Predict text from text. Parameters text (str) – stop (Optional[Sequence[str]]) – kwargs (Any) – Return type str predict_messages(messages, *, stop=None, **kwargs) Predict message from messages. Parameters messa...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-340
stream(prompt, stop=None, run_manager=None)[source] Yields results objects as they are generated in real time. BETA: this is a beta feature while we figure out the right abstraction. Once that happens, this interface could change. It also calls the callback manager’s on_llm_new_token event with similar parameters to t...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-341
temperature = 0.5 ) for chunk in llm.stream("Ask 'Hi, how are you?' like a pirate:'", stop=["'"," β€œ]):result = chunk[β€œchoices”][0] print(result[β€œtext”], end=’’, flush=True) Parameters prompt (str) – stop (Optional[List[str]]) – run_manager (Optional[langchain.callbacks.manager.CallbackManagerForLLMRun]) – Re...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-342
constructor. property lc_namespace: List[str] Return the namespace of the langchain object. eg. [β€œlangchain”, β€œllms”, β€œopenai”] property lc_secrets: Dict[str, str] Return a map of constructor argument names to secret ids. eg. {β€œopenai_api_key”: β€œOPENAI_API_KEY”} property lc_serializable: bool Return whether or not t...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-343
class langchain.llms.TextGen(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, model_url, max_new_tokens=250, do_sample=True, temperature=1.3, top_p=0.1, typical_p=1, epsilon_cutoff=0, eta_cutoff=0, repetition_penalty=1.18, top_k=40, min_length=0, no_repeat_ngram_size=0, num_beams=1, penalt...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-344
and –api added as a command-line option. Suggested installation, use one-click installer for your OS: https://github.com/oobabooga/text-generation-webui#one-click-installers Paremeters below taken from text-generation-webui api example: https://github.com/oobabooga/text-generation-webui/blob/main/api-examples/api-examp...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-345
do_sample (bool) – temperature (Optional[float]) – top_p (Optional[float]) – typical_p (Optional[float]) – epsilon_cutoff (Optional[float]) – eta_cutoff (Optional[float]) – repetition_penalty (Optional[float]) – top_k (Optional[float]) – min_length (Optional[int]) – no_repeat_ngram_size (Optional[int]) – num_...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-346
Return type None attribute add_bos_token: bool = True Add the bos_token to the beginning of prompts. Disabling this can make the replies more creative. attribute ban_eos_token: bool = False Ban the eos_token. Forces the model to never end the generation prematurely. attribute do_sample: bool = True Do sample attribu...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-347
The full URL to the textgen webui including http[s]://host:port attribute no_repeat_ngram_size: Optional[int] = 0 If not set to 0, specifies the length of token sets that are completely blocked from repeating at all. Higher values = blocks larger phrases, lower values = blocks words or letters from repeating. Only 0 o...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-348
Skip special tokens. Some specific models need this unset. attribute stopping_strings: Optional[List[str]] = [] A list of strings to stop generation when encountered. attribute streaming: bool = False Whether to stream the results, token by token (currently unimplemented). attribute tags: Optional[List[str]] = None ...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-349
number. Higher value = higher range of possible random results. attribute truncation_length: Optional[int] = 2048 Truncate the prompt up to this length. The leftmost tokens are removed if the prompt exceeds this length. Most models require this to be at most 2048. attribute typical_p: Optional[float] = 1 If not set t...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-350
stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – kwargs (Any) – Return type str async agenerate(prompts, stop=None, callbacks=None, *, tags=None, **kwargs) Run the LLM on the given prompt and input. Parameter...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-351
Parameters prompts (List[langchain.schema.PromptValue]) – stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – kwargs (Any) – Return type langchain.schema.LLMResult async apredict(text, *, stop=None, **kwargs) P...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-352
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 Parameters _fields_set (Optional[SetStr]) – values (Any) – Return type Model copy...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-353
the new model: you should trust this data deep (bool) – set to True to make a deep copy of the model self (Model) – Returns new model instance Return type Model dict(**kwargs) Return a dictionary of the LLM. Parameters kwargs (Any) – Return type Dict generate(prompts, stop=None, callbacks=None, *, tags=None, **kwarg...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-354
Take in a list of prompt values and return an LLMResult. Parameters prompts (List[langchain.schema.PromptValue]) – stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – kwargs (Any) – Return type langchain.schema....
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-355
Return type List[int] json(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=None, models_as_dict=True, **dumps_kwargs) Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optio...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-356
models_as_dict (bool) – dumps_kwargs (Any) – Return type unicode predict(text, *, stop=None, **kwargs) Predict text from text. Parameters text (str) – stop (Optional[Sequence[str]]) – kwargs (Any) – Return type str predict_messages(messages, *, stop=None, **kwargs) Predict message from messages. Parameters messa...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-357
classmethod update_forward_refs(**localns) Try to update ForwardRefs on fields based on this Model, globalns and localns. Parameters localns (Any) – Return type None property lc_attributes: Dict Return a list of attribute names that should be included in the serialized kwargs. These attributes must be accepted by th...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-358
class langchain.llms.ManifestWrapper(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, client=None, llm_kwargs=None)[source] Bases: langchain.llms.base.LLM Wrapper around HazyResearch’s Manifest library. Parameters cache (Optional[bool]) – verbose (bool) – callbacks (Optional[Union[List[...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-359
Whether to print out response text. __call__(prompt, stop=None, callbacks=None, **kwargs) Check Cache and run the LLM on the given prompt and input. Parameters prompt (str) – stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallba...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-360
kwargs (Any) – Return type langchain.schema.LLMResult async agenerate_prompt(prompts, stop=None, callbacks=None, **kwargs) Take in a list of prompt values and return an LLMResult. Parameters prompts (List[langchain.schema.PromptValue]) – stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callback...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-361
Predict message from messages. Parameters messages (List[langchain.schema.BaseMessage]) – stop (Optional[Sequence[str]]) – kwargs (Any) – Return type langchain.schema.BaseMessage classmethod construct(_fields_set=None, **values) Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated d...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-362
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to exclude from new model, as with values this takes precedence over include update (Optional[DictStrAny]) – 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 (bool...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-363
stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – tags (Optional[List[str]]) – kwargs (Any) – Return type langchain.schema.LLMResult generate_prompt(prompts, stop=None, callbacks=None, **kwargs) Take in a lis...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-364
Return type int get_num_tokens_from_messages(messages) Get the number of tokens in the message. Parameters messages (List[langchain.schema.BaseMessage]) – Return type int get_token_ids(text) Get the token present in the text. Parameters text (str) – Return type List[int] json(*, include=None, exclude=None, by_alias...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-365
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – by_alias (bool) – skip_defaults (Optional[bool]) – exclude_unset (bool) – exclude_defaults (bool) – exclude_none (bool) – encoder (Optional[Callable[[Any], Any]]) – models_as_dict (bool) – dumps_kwargs (Any) – Return type unicode predict(text, *,...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-366
kwargs (Any) – Return type langchain.schema.BaseMessage save(file_path) Save the LLM. Parameters file_path (Union[pathlib.Path, str]) – Path to file to save the LLM to. Return type None Example: .. code-block:: python llm.save(file_path=”path/llm.yaml”) classmethod update_forward_refs(**localns) Try to update Forwar...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-367
property lc_secrets: Dict[str, str] Return a map of constructor argument names to secret ids. eg. {β€œopenai_api_key”: β€œOPENAI_API_KEY”} property lc_serializable: bool Return whether or not the class is serializable. class langchain.llms.Modal(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=Non...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-368
verbose (bool) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – tags (Optional[List[str]]) – endpoint_url (str) – model_kwargs (Dict[str, Any]) – Return type...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-369
Parameters prompt (str) – stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – kwargs (Any) – Return type str async agenerate(prompts, stop=None, callbacks=None, *, tags=None, **kwargs) Run the LLM on the given ...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-370
Parameters prompts (List[langchain.schema.PromptValue]) – stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – kwargs (Any) – Return type langchain.schema.LLMResult async apredict(text, *, stop=None, **kwargs) P...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-371
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 Parameters _fields_set (Optional[SetStr]) – values (Any) – Return type Model copy...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-372
the new model: you should trust this data deep (bool) – set to True to make a deep copy of the model self (Model) – Returns new model instance Return type Model dict(**kwargs) Return a dictionary of the LLM. Parameters kwargs (Any) – Return type Dict generate(prompts, stop=None, callbacks=None, *, tags=None, **kwarg...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-373
Take in a list of prompt values and return an LLMResult. Parameters prompts (List[langchain.schema.PromptValue]) – stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – kwargs (Any) – Return type langchain.schema....
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-374
Return type List[int] json(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=None, models_as_dict=True, **dumps_kwargs) Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optio...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-375
models_as_dict (bool) – dumps_kwargs (Any) – Return type unicode predict(text, *, stop=None, **kwargs) Predict text from text. Parameters text (str) – stop (Optional[Sequence[str]]) – kwargs (Any) – Return type str predict_messages(messages, *, stop=None, **kwargs) Predict message from messages. Parameters messa...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-376
classmethod update_forward_refs(**localns) Try to update ForwardRefs on fields based on this Model, globalns and localns. Parameters localns (Any) – Return type None property lc_attributes: Dict Return a list of attribute names that should be included in the serialized kwargs. These attributes must be accepted by th...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-377
class langchain.llms.MosaicML(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, endpoint_url='https://models.hosted-on.mosaicml.hosting/mpt-7b-instruct/v1/predict', inject_instruction_format=False, model_kwargs=None, retry_sleep=1.0, mosaicml_api_token=None)[source] Bases: langchain.llms.b...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-378
endpoint_url=endpoint_url, mosaicml_api_token="my-api-key" ) Parameters cache (Optional[bool]) – verbose (bool) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-379
Whether to inject the instruction format into the prompt. attribute model_kwargs: Optional[dict] = None Key word arguments to pass to the model. attribute retry_sleep: float = 1.0 How long to try sleeping for if a rate limit is encountered attribute tags: Optional[List[str]] = None Tags to add to the run trace. attr...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-380
Return type str async agenerate(prompts, stop=None, callbacks=None, *, tags=None, **kwargs) Run the LLM on the given prompt and input. Parameters prompts (List[str]) – stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManag...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-381
kwargs (Any) – Return type langchain.schema.LLMResult async apredict(text, *, stop=None, **kwargs) Predict text from text. Parameters text (str) – stop (Optional[Sequence[str]]) – kwargs (Any) – Return type str async apredict_messages(messages, *, stop=None, **kwargs) Predict message from messages. Parameters mes...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-382
Parameters _fields_set (Optional[SetStr]) – values (Any) – Return type Model copy(*, include=None, exclude=None, update=None, deep=False) Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to include in ...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-383
Model dict(**kwargs) Return a dictionary of the LLM. Parameters kwargs (Any) – Return type Dict generate(prompts, stop=None, callbacks=None, *, tags=None, **kwargs) Run the LLM on the given prompt and input. Parameters prompts (List[str]) – stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.call...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-384
stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – kwargs (Any) – Return type langchain.schema.LLMResult get_num_tokens(text) Get the number of tokens present in the text. Parameters text (str) – Return type i...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-385
Return type List[int] json(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=None, models_as_dict=True, **dumps_kwargs) Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optio...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-386
models_as_dict (bool) – dumps_kwargs (Any) – Return type unicode predict(text, *, stop=None, **kwargs) Predict text from text. Parameters text (str) – stop (Optional[Sequence[str]]) – kwargs (Any) – Return type str predict_messages(messages, *, stop=None, **kwargs) Predict message from messages. Parameters messa...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-387
classmethod update_forward_refs(**localns) Try to update ForwardRefs on fields based on this Model, globalns and localns. Parameters localns (Any) – Return type None property lc_attributes: Dict Return a list of attribute names that should be included in the serialized kwargs. These attributes must be accepted by th...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-388
class langchain.llms.NLPCloud(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, client=None, model_name='finetuned-gpt-neox-20b', temperature=0.7, min_length=1, max_length=256, length_no_input=True, remove_input=True, remove_end_sequence=True, bad_words=[], top_p=1, top_k=50, repetition_pen...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-389
from langchain.llms import NLPCloud nlpcloud = NLPCloud(model="gpt-neox-20b") Parameters cache (Optional[bool]) – verbose (bool) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – callback_manager (Optional[langchain.callbacks.base.BaseCa...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-390
repetition_penalty (float) – length_penalty (float) – do_sample (bool) – num_beams (int) – early_stopping (bool) – num_return_sequences (int) – nlpcloud_api_key (Optional[str]) – Return type None attribute bad_words: List[str] = [] List of tokens not allowed to be generated. attribute do_sample: bool = True Wh...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-391
The maximum number of tokens to generate in the completion. attribute min_length: int = 1 The minimum number of tokens to generate in the completion. attribute model_name: str = 'finetuned-gpt-neox-20b' Model name to use. attribute num_beams: int = 1 Number of beams for beam search. attribute num_return_sequences: i...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-392
Tags to add to the run trace. attribute temperature: float = 0.7 What sampling temperature to use. attribute top_k: int = 50 The number of highest probability tokens to keep for top-k filtering. attribute top_p: int = 1 Total probability mass of tokens to consider at each step. attribute verbose: bool [Optional] Wh...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-393
Return type str async agenerate(prompts, stop=None, callbacks=None, *, tags=None, **kwargs) Run the LLM on the given prompt and input. Parameters prompts (List[str]) – stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManag...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-394
kwargs (Any) – Return type langchain.schema.LLMResult async apredict(text, *, stop=None, **kwargs) Predict text from text. Parameters text (str) – stop (Optional[Sequence[str]]) – kwargs (Any) – Return type str async apredict_messages(messages, *, stop=None, **kwargs) Predict message from messages. Parameters mes...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-395
Parameters _fields_set (Optional[SetStr]) – values (Any) – Return type Model copy(*, include=None, exclude=None, update=None, deep=False) Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to include in ...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-396
Model dict(**kwargs) Return a dictionary of the LLM. Parameters kwargs (Any) – Return type Dict generate(prompts, stop=None, callbacks=None, *, tags=None, **kwargs) Run the LLM on the given prompt and input. Parameters prompts (List[str]) – stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.call...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-397
stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – kwargs (Any) – Return type langchain.schema.LLMResult get_num_tokens(text) Get the number of tokens present in the text. Parameters text (str) – Return type i...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-398
Return type List[int] json(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=None, models_as_dict=True, **dumps_kwargs) Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optio...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-399
models_as_dict (bool) – dumps_kwargs (Any) – Return type unicode predict(text, *, stop=None, **kwargs) Predict text from text. Parameters text (str) – stop (Optional[Sequence[str]]) – kwargs (Any) – Return type str predict_messages(messages, *, stop=None, **kwargs) Predict message from messages. Parameters messa...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-400
classmethod update_forward_refs(**localns) Try to update ForwardRefs on fields based on this Model, globalns and localns. Parameters localns (Any) – Return type None property lc_attributes: Dict Return a list of attribute names that should be included in the serialized kwargs. These attributes must be accepted by th...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-401
class langchain.llms.OpenAI(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, client=None, model='text-davinci-003', temperature=0.7, max_tokens=256, top_p=1, frequency_penalty=0, presence_penalty=0, n=1, best_of=1, model_kwargs=None, openai_api_key=None, openai_api_base=None, openai_organi...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-402
Any parameters that are valid to be passed to the openai.create call can be passed in, even if not explicitly saved on this class. Example from langchain.llms import OpenAI openai = OpenAI(model_name="text-davinci-003") Parameters cache (Optional[bool]) – verbose (bool) – callbacks (Optional[Union[List[langchain.call...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-403
best_of (int) – model_kwargs (Dict[str, Any]) – openai_api_key (Optional[str]) – openai_api_base (Optional[str]) – openai_organization (Optional[str]) – openai_proxy (Optional[str]) – batch_size (int) – request_timeout (Optional[Union[float, Tuple[float, float]]]) – logit_bias (Optional[Dict[str, float]]) – ma...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-404
Set of special tokens that are allowed。 attribute batch_size: int = 20 Batch size to use when passing multiple documents to generate. attribute best_of: int = 1 Generates best_of completions server-side and returns the β€œbest”. attribute disallowed_special: Union[Literal['all'], Collection[str]] = 'all' Set of specia...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-405
the models maximal context size. attribute model_kwargs: Dict[str, Any] [Optional] Holds any model parameters valid for create call not explicitly specified. attribute model_name: str = 'text-davinci-003' (alias 'model') Model name to use. attribute n: int = 1 How many completions to generate for each prompt. attrib...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-406
What sampling temperature to use. attribute tiktoken_model_name: Optional[str] = None The model name to pass to tiktoken when using this class. Tiktoken is used to count the number of tokens in documents to constrain them to be under a certain limit. By default, when set to None, this will be the same as the embedding...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-407
attribute verbose: bool [Optional] Whether to print out response text. __call__(prompt, stop=None, callbacks=None, **kwargs) Check Cache and run the LLM on the given prompt and input. Parameters prompt (str) – stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler],...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-408
tags (Optional[List[str]]) – kwargs (Any) – Return type langchain.schema.LLMResult async agenerate_prompt(prompts, stop=None, callbacks=None, **kwargs) Take in a list of prompt values and return an LLMResult. Parameters prompts (List[langchain.schema.PromptValue]) – stop (Optional[List[str]]) – callbacks (Optional...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-409
Predict message from messages. Parameters messages (List[langchain.schema.BaseMessage]) – stop (Optional[Sequence[str]]) – kwargs (Any) – Return type langchain.schema.BaseMessage classmethod construct(_fields_set=None, **values) Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated d...
https://api.python.langchain.com/en/latest/modules/llms.html
0e0436a883fe-410
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to exclude from new model, as with values this takes precedence over include update (Optional[DictStrAny]) – 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 (bool...
https://api.python.langchain.com/en/latest/modules/llms.html