agenerate_prompt() — langchain Function Reference
Architecture documentation for the agenerate_prompt() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 61a4be48_28a1_3476_27b7_7f2b5fdae997["agenerate_prompt()"] f5a29046_740d_1358_3615_8cc689b26ca9["BaseLanguageModel"] 61a4be48_28a1_3476_27b7_7f2b5fdae997 -->|defined in| f5a29046_740d_1358_3615_8cc689b26ca9 style 61a4be48_28a1_3476_27b7_7f2b5fdae997 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/language_models/base.py lines 251–292
async def agenerate_prompt(
self,
prompts: list[PromptValue],
stop: list[str] | None = None,
callbacks: Callbacks = None,
**kwargs: Any,
) -> LLMResult:
"""Asynchronously pass a sequence of prompts and return model generations.
This method should make use of batched calls for models that expose a batched
API.
Use this method when you want to:
1. Take advantage of batched calls,
2. Need more output from the model than just the top generated value,
3. Are building chains that are agnostic to the underlying language model
type (e.g., pure text completion models vs chat models).
Args:
prompts: List of `PromptValue` objects.
A `PromptValue` is an object that can be converted to match the format
of any language model (string for pure text generation models and
`BaseMessage` objects for chat models).
stop: Stop words to use when generating.
Model output is cut off at the first occurrence of any of these
substrings.
callbacks: `Callbacks` to pass through.
Used for executing additional functionality, such as logging or
streaming, throughout generation.
**kwargs: Arbitrary additional keyword arguments.
These are usually passed to the model provider API call.
Returns:
An `LLMResult`, which contains a list of candidate `Generation` objects for
each input prompt and additional model provider-specific output.
"""
Domain
Subdomains
Source
Frequently Asked Questions
What does agenerate_prompt() do?
agenerate_prompt() is a function in the langchain codebase, defined in libs/core/langchain_core/language_models/base.py.
Where is agenerate_prompt() defined?
agenerate_prompt() is defined in libs/core/langchain_core/language_models/base.py at line 251.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free