Linear
SimpleLinearPipeline ¶
Bases: BaseComponent
A simple pipeline for running a function with a prompt, a language model, and an optional post-processor.
Attributes:
Name | Type | Description |
---|---|---|
prompt |
BasePromptComponent
|
The prompt component used to generate the initial input. |
llm |
Union[ChatLLM, LLM]
|
The language model component used to generate the output. |
post_processor |
Union[BaseComponent, Callable[[IO_Type], IO_Type]]
|
An optional post-processor component or function. |
Example Usage
Source code in libs/kotaemon/kotaemon/llms/linear.py
run ¶
Run the function with the given arguments and return the final output as a Document object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
llm_kwargs
|
dict
|
Keyword arguments for the llm call. |
{}
|
post_processor_kwargs
|
dict
|
Keyword arguments for the post_processor. |
{}
|
**prompt_kwargs
|
Keyword arguments for populating the prompt. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
Document |
The final output of the function as a Document object. |
Source code in libs/kotaemon/kotaemon/llms/linear.py
GatedLinearPipeline ¶
Bases: SimpleLinearPipeline
A pipeline that extends the SimpleLinearPipeline class and adds a condition attribute.
Attributes:
Name | Type | Description |
---|---|---|
condition |
Callable[[IO_Type], Any]
|
A callable function that represents the condition. |
Usage
Source code in libs/kotaemon/kotaemon/llms/linear.py
run ¶
Run the pipeline with the given arguments and return the final output as a Document object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
condition_text
|
str
|
The condition text to evaluate. Default to None. |
None
|
llm_kwargs
|
dict
|
Additional keyword arguments for the language model call. |
{}
|
post_processor_kwargs
|
dict
|
Additional keyword arguments for the post-processor. |
{}
|
**prompt_kwargs
|
Keyword arguments for populating the prompt. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
Document |
Document
|
The final output of the pipeline as a Document object. |
Raises:
Type | Description |
---|---|
ValueError
|
If condition_text is None |