Knowledgator UTCA
KnowledgatorGitHubDiscord
  • Welcome to UTCA documentation!
  • Quickstart
  • Concepts
    • Components
    • Types of components
    • ExecutionSchema
    • Context
    • Scopes
  • Development and Contribution
    • Contribution
    • Future relises
  • Framework structure
  • Core
    • Component
    • BaseExecutor
    • Action
    • Executable
    • Evaluator
    • Memory management
    • Schemas
    • Exceptions
  • Structural components
    • ExecutionSchema
    • Switch
    • ForEach
    • Filter
    • While
    • Condition
    • BREAK
    • Log
  • Base Actions
    • Flush
    • AddData
    • RenameAttribute
    • RenameAttributeQuery
    • SetValue
    • UnpackValue
    • NestToKey
    • ExecuteFunction
  • Predictors
    • Predictor
    • Transformers predictors
    • Transformers schemas
    • TokenSearcherPredictor
    • ComprehendItPredictor
    • GLiNERPredictor
    • OpenAIChatGPTPredictor
    • OpenAIWhisperPredictor
  • Tasks
    • Task
    • ComprehendIt
    • TokenSearcherTextCleaner
    • TokenSearcherNER
    • TokenSearcherQandA
    • TokenSearcherRelationExtraction
    • GLiNER
    • GLiNERRelationExtraction
    • GLiNERQandA
    • OpenAIChat
    • WhisperSpeechToText
    • TransformersTextToSpeech
    • TransformersChartsAndPlotsAnalysis
    • TransformersDocumentQandA
    • TransformersImageClassification
    • TransformersVisualQandA
    • TransformersObjectDetection
    • TransformersTextEmbedding
    • TransformersEntityLinking
    • TransformersTokenClassifier
    • TransformersTextSummarization
    • TransformersTextualQandA
    • TransformersTextClassification
    • TransformersChat
    • Objects
    • Chat tasks utilities
    • Relation extraction tasks utilities
  • Executable Schemas
    • SemanticSearchSchema
    • Web2Meaning
    • RequestsHTML
  • Datasources
    • Audio
    • DB
      • SQL
      • Neo4j
      • Chroma
      • Qdrant
    • Google Documents
    • Google Sheets
    • Image
    • Index
    • JSON
    • PDF
    • Plain text
    • Video
  • Conditions
    • RePattern
    • SemanticCondition
  • APIs
    • GoogleCloudClient
  • Integrations
    • Google Cloud
  • Examples
    • Basic image classification
    • Text to speech
    • PDF document processing
Powered by GitBook
On this page
  • Module: implementation.tasks
  • Default predictor
  • Methods and properties
  • __init__
  • ChatPreprocessor
  • execute
  • ChatPostprocessor
  • execute
  1. Tasks

TransformersChat

Basic chat task

PreviousTransformersTextClassificationNextObjects

Last updated 1 year ago

Subclass of .

Module: .tasks

Default predictor

This task uses by default with this configuration:

TransformersPipeline(
    TransformersPipelineConfig(
        task="text-generation", 
        model="TinyLlama/TinyLlama-1.1B-Chat-v1.0",
        kwargs={
            "max_new_tokens": 256, 
            "do_sample": True, 
            "temperature": 0.3, 
            "top_k": 50, 
            "top_p": 0.95,
        }
    ),
    input_class=TransformersBasicInput,
    output_class=TransformersBasicOutput
)

See:

Methods and properties

Main methods and properties


__init__

Arguments:

  • messages (Optional[str], optional): Key to use to access memory for messages. If equals to None, a unique key will be generated. Defaults to None.

Note: This parameter will function as expected only when using the default preprocessor and postprocessor.

  • name (Optional[str], optional): Name for identification. If equals to None, class name will be used. Defaults to None.




ChatPreprocessor


execute

Arguments:

  • input_data (Dict[str, Any]): Expected keys:

    • "prompt" (str): Input prompt;

Returns:

  • Dict[str, Any]: Expected keys:

    • "messages" (Iterable[ChatCompletionMessageParam]): Input messages;




ChatPostprocessor


execute

Arguments:

  • input_data (Dict[str, Any]): Expected keys:

    • "output" (List[Dict[str, Any]]): Expected keys:

      • "generated_text" (str);

Returns:

  • str: Response message.



predictor ([Any, Any], optional): Predictor that will be used in task. If equals to None, will be used. Defaults to None.

preprocess (Optional[], optional): Component executed before predictor. If equals to None, default component will be used. Defaults to None. Default component: | | | |

postprocess (Optional[], optional): Component executed after predictor. If equals to None, default component will be used. Defaults to None. Default component: | | |

input_class (Type[], optional): Class for input validation. Defaults to .

output_class (Type[], optional): Class for output validation. Defaults to .

Create message template for input prompt. Subclass of . Type of [Dict[str, Any], Dict[str, Any]].

Process API output. Subclass of . Type of [Dict[str, Any], Dict[str, Any]].

Action
Action
Action
Action
Predictor
default predictor
Task
Component
RenameAttribute
ChatPreprocessor
Component
ChatPostprocessor
Input
implementation
GetMemory
SetMemory
GetMemory
SetMemory
TransformersModel
TransformersPipeline
TransformersPipelineConfig
TransformersBasicInput
TransformersBasicOutput
NEROutputType
ChatAddContext
ChatUpdateContext
ChatInput
ChatOutput