dlgforge.pipeline.history¶
Conversation history formatting helpers.
format_history(history)
¶
Format history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
history
|
List[Dict[str, Any]]
|
Conversation or message data used during processing. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Value produced by this API. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - Primarily performs in-memory transformations.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.pipeline.history import format_history
>>> format_history(...)
build_conversation_history(turns)
¶
Build conversation history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
turns
|
List[Dict[str, Any]]
|
Conversation or message data used during processing. |
required |
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List[Dict[str, Any]]: Constructed value derived from the provided inputs. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - Primarily performs in-memory transformations.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.pipeline.history import build_conversation_history
>>> build_conversation_history(...)
build_public_history(turns)
¶
Build public history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
turns
|
List[Dict[str, Any]]
|
Conversation or message data used during processing. |
required |
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List[Dict[str, Any]]: Constructed value derived from the provided inputs. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - Primarily performs in-memory transformations.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.pipeline.history import build_public_history
>>> build_public_history(...)
messages_up_to_turn(messages, turn_index)
¶
Messages up to turn.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
messages
|
List[Dict[str, Any]]
|
Conversation or message data used during processing. |
required |
turn_index
|
int | None
|
Numeric control value for processing behavior. |
required |
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List[Dict[str, Any]]: Value produced by this API. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - Primarily performs in-memory transformations.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.pipeline.history import messages_up_to_turn
>>> messages_up_to_turn(...)