langtree.prompting

Submodules

Package Contents

Classes

Data

dict() -> new empty dictionary

ChatMessage

A generic chat message with attributes role and content.

SystemMessage

A system message with predefined role as "system" and an attribute content.

AssistantMessage

An assistant message with predefined role as "assistant" and an attribute content.

UserMessage

A user message with predefined role as "user" and an attribute content.

FunctionMessage

A function message with attributes role, content, and name.

class langtree.prompting.Data(*args, **kwargs)[source]

Bases: dict

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

__call__(**kwargs)[source]
class langtree.prompting.ChatMessage(role=None, content=None)[source]

Bases: langtree.utils.data.Data

A generic chat message with attributes role and content.

role
content
class langtree.prompting.SystemMessage(content=None)[source]

Bases: ChatMessage

A system message with predefined role as “system” and an attribute content.

role = 'system'
content
class langtree.prompting.AssistantMessage(content=None)[source]

Bases: ChatMessage

An assistant message with predefined role as “assistant” and an attribute content.

role = 'assistant'
content
class langtree.prompting.UserMessage(content=None)[source]

Bases: ChatMessage

A user message with predefined role as “user” and an attribute content.

role = 'user'
content
class langtree.prompting.FunctionMessage(content=None)[source]

Bases: ChatMessage

A function message with attributes role, content, and name. The role is predefined as “function”.

role = 'function'
name