gllm-inference-binary 0.5.62__cp313-cp313-win_amd64.whl → 0.5.63__cp313-cp313-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of gllm-inference-binary might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  from _typeshed import Incomplete
2
2
  from gllm_inference.prompt_builder.format_strategy import JinjaFormatStrategy as JinjaFormatStrategy, StringFormatStrategy as StringFormatStrategy
3
- from gllm_inference.schema import JinjaEnvType as JinjaEnvType, Message as Message, MessageContent as MessageContent, MessageRole as MessageRole
3
+ from gllm_inference.schema import HistoryFormatter as HistoryFormatter, JinjaEnvType as JinjaEnvType, Message as Message, MessageContent as MessageContent, MessageRole as MessageRole
4
4
  from jinja2.sandbox import SandboxedEnvironment as SandboxedEnvironment
5
5
  from typing import Any
6
6
 
@@ -13,13 +13,15 @@ class PromptBuilder:
13
13
  prompt_key_set (set[str]): A set of expected keys that must be present in the prompt templates.
14
14
  key_defaults (dict[str, str]): Default values for the keys in the prompt templates.
15
15
  strategy (BasePromptFormattingStrategy): The format strategy to be used for formatting the prompt.
16
+ history_formatter (HistoryFormatter): The history formatter to be used for formatting the history.
16
17
  """
17
18
  key_defaults: Incomplete
18
19
  system_template: Incomplete
19
20
  user_template: Incomplete
21
+ history_formatter: Incomplete
20
22
  strategy: Incomplete
21
23
  prompt_key_set: Incomplete
22
- def __init__(self, system_template: str = '', user_template: str = '', key_defaults: dict[str, str] | None = None, ignore_extra_keys: bool | None = None, use_jinja: bool = False, jinja_env: JinjaEnvType | SandboxedEnvironment = ...) -> None:
24
+ def __init__(self, system_template: str = '', user_template: str = '', key_defaults: dict[str, str] | None = None, ignore_extra_keys: bool | None = None, history_formatter: HistoryFormatter | None = None, use_jinja: bool | None = False, jinja_env: JinjaEnvType | SandboxedEnvironment | None = None) -> None:
23
25
  """Initializes a new instance of the PromptBuilder class.
24
26
 
25
27
  Args:
@@ -32,6 +34,8 @@ class PromptBuilder:
32
34
  Defaults to None, in which case no default values will be assigned to the keys.
33
35
  ignore_extra_keys (bool | None, optional): Deprecated parameter. Will be removed in v0.6. Extra keys
34
36
  will always raise a warning only instead of raising an error.
37
+ history_formatter (HistoryFormatter | None, optional): The history formatter to be used for formatting
38
+ the history. Defaults to None, in which case the history will be used as is.
35
39
  use_jinja (bool, optional): Whether to use Jinja for rendering the prompt templates.
36
40
  Defaults to False.
37
41
  jinja_env (JinjaEnvType | SandboxedEnvironment, optional): The environment for Jinja rendering.
@@ -4,6 +4,7 @@ from gllm_inference.schema.code_exec_result import CodeExecResult as CodeExecRes
4
4
  from gllm_inference.schema.config import TruncationConfig as TruncationConfig
5
5
  from gllm_inference.schema.enums import AttachmentType as AttachmentType, BatchStatus as BatchStatus, EmitDataType as EmitDataType, JinjaEnvType as JinjaEnvType, LMEventType as LMEventType, LMEventTypeSuffix as LMEventTypeSuffix, LMOutputType as LMOutputType, MessageRole as MessageRole, TruncateSide as TruncateSide
6
6
  from gllm_inference.schema.events import ActivityEvent as ActivityEvent, CodeEvent as CodeEvent, ThinkingEvent as ThinkingEvent
7
+ from gllm_inference.schema.formatter import HistoryFormatter as HistoryFormatter
7
8
  from gllm_inference.schema.lm_input import LMInput as LMInput
8
9
  from gllm_inference.schema.lm_output import LMOutput as LMOutput, LMOutputData as LMOutputData, LMOutputItem as LMOutputItem
9
10
  from gllm_inference.schema.mcp import MCPCall as MCPCall, MCPServer as MCPServer
@@ -15,4 +16,4 @@ from gllm_inference.schema.tool_call import ToolCall as ToolCall
15
16
  from gllm_inference.schema.tool_result import ToolResult as ToolResult
16
17
  from gllm_inference.schema.type_alias import EMContent as EMContent, MessageContent as MessageContent, ResponseSchema as ResponseSchema, Vector as Vector
17
18
 
18
- __all__ = ['Activity', 'ActivityEvent', 'Attachment', 'AttachmentType', 'BatchStatus', 'CodeEvent', 'CodeExecResult', 'EMContent', 'EmitDataType', 'InputTokenDetails', 'JinjaEnvType', 'LMEventType', 'LMEventTypeSuffix', 'LMInput', 'LMOutput', 'LMOutputItem', 'LMOutputData', 'LMOutputType', 'MCPCall', 'MCPCallActivity', 'MCPListToolsActivity', 'MCPServer', 'Message', 'MessageContent', 'MessageRole', 'ModelId', 'ModelProvider', 'OutputTokenDetails', 'Reasoning', 'ResponseSchema', 'ThinkingEvent', 'TokenUsage', 'ToolCall', 'ToolResult', 'TruncateSide', 'TruncationConfig', 'Vector', 'WebSearchActivity']
19
+ __all__ = ['Activity', 'ActivityEvent', 'Attachment', 'AttachmentType', 'BatchStatus', 'CodeEvent', 'CodeExecResult', 'EMContent', 'EmitDataType', 'HistoryFormatter', 'InputTokenDetails', 'JinjaEnvType', 'LMEventType', 'LMEventTypeSuffix', 'LMInput', 'LMOutput', 'LMOutputItem', 'LMOutputData', 'LMOutputType', 'MCPCall', 'MCPCallActivity', 'MCPListToolsActivity', 'MCPServer', 'Message', 'MessageContent', 'MessageRole', 'ModelId', 'ModelProvider', 'OutputTokenDetails', 'Reasoning', 'ResponseSchema', 'ThinkingEvent', 'TokenUsage', 'ToolCall', 'ToolResult', 'TruncateSide', 'TruncationConfig', 'Vector', 'WebSearchActivity']
@@ -0,0 +1,31 @@
1
+ from gllm_inference.schema.enums import MessageRole as MessageRole
2
+ from gllm_inference.schema.message import Message as Message
3
+ from gllm_inference.schema.type_alias import MessageContent as MessageContent
4
+ from pydantic import BaseModel
5
+
6
+ class HistoryFormatter(BaseModel):
7
+ """Configuration for history formatting.
8
+
9
+ Attributes:
10
+ prefix_user_message (str): Prefix for user messages.
11
+ suffix_user_message (str): Suffix for user messages.
12
+ prefix_assistant_message (str): Prefix for assistant messages.
13
+ suffix_assistant_message (str): Suffix for assistant messages.
14
+ """
15
+ prefix_user_message: str
16
+ suffix_user_message: str
17
+ prefix_assistant_message: str
18
+ suffix_assistant_message: str
19
+ def format_history(self, history: list[Message]) -> list[Message]:
20
+ """Formats a list of messages based on their roles.
21
+
22
+ This method formats each message in the history list by applying the appropriate
23
+ formatting based on the message role (user or assistant). Other message types
24
+ are added to the result without modification.
25
+
26
+ Args:
27
+ history (list[Message]): The list of messages to format.
28
+
29
+ Returns:
30
+ list[Message]: A new list containing the formatted messages.
31
+ """
Binary file
gllm_inference.pyi CHANGED
@@ -136,6 +136,7 @@ import jinja2.sandbox
136
136
  import gllm_inference.schema.JinjaEnvType
137
137
  import gllm_inference.prompt_builder.format_strategy.JinjaFormatStrategy
138
138
  import gllm_inference.prompt_builder.format_strategy.StringFormatStrategy
139
+ import gllm_inference.schema.HistoryFormatter
139
140
  import transformers
140
141
  import gllm_inference.prompt_formatter.HuggingFacePromptFormatter
141
142
  import traceback
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: gllm-inference-binary
3
- Version: 0.5.62
3
+ Version: 0.5.63
4
4
  Summary: A library containing components related to model inferences in Gen AI applications.
5
- Author-email: Henry Wicaksono <henry.wicaksono@gdplabs.id>, Resti Febrina <resti.febrina@gdplabs.id>
5
+ Author-email: Henry Wicaksono <henry.wicaksono@gdplabs.id>, "Delfia N. A. Putri" <delfia.n.a.putri@gdplabs.id>
6
6
  Requires-Python: <3.14,>=3.11
7
7
  Description-Content-Type: text/markdown
8
8
  Requires-Dist: poetry<3.0.0,>=2.1.3
@@ -1,5 +1,5 @@
1
- gllm_inference.cp313-win_amd64.pyd,sha256=a8pnMNYmesZ6SgSG09bgFTzy17VS0WnUP8AV1cJQwqY,4013056
2
- gllm_inference.pyi,sha256=kqoM8wZ2DtFx8sbbAOaKn6iolfDpeGHOWoDZbSV7LRo,5147
1
+ gllm_inference.cp313-win_amd64.pyd,sha256=AWiMMRqsrTtKNukEqThaaYfSb2Cuj2xPEFWwwVZc3Es,4038656
2
+ gllm_inference.pyi,sha256=3UoxsyZnC_6PhNzIKIp37rL6CNEw-Ve0RJHiG9jLOBY,5193
3
3
  gllm_inference/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  gllm_inference/constants.pyi,sha256=8jIYOyxJYVWUYXSXF3vag9HhHwjq1iU9tzPiosRHkWk,328
5
5
  gllm_inference/builder/__init__.pyi,sha256=-bw1uDx7CAM7pkvjvb1ZXku9zXlQ7aEAyC83KIn3bz8,506
@@ -85,7 +85,7 @@ gllm_inference/output_parser/__init__.pyi,sha256=dhAeRTBxc6CfS8bhnHjbtrnyqJ1iyff
85
85
  gllm_inference/output_parser/json_output_parser.pyi,sha256=YtgQh8Uzy8W_Tgh8DfuR7VFFS7qvLEasiTwRfaGZZEU,2993
86
86
  gllm_inference/output_parser/output_parser.pyi,sha256=-Xu5onKCBDqShcO-VrQh5icqAmXdihGc3rkZxL93swg,975
87
87
  gllm_inference/prompt_builder/__init__.pyi,sha256=mPsbiafzSNHsgN-CuzjhgZpfXfi1pPC3_gdsq2p0EM4,120
88
- gllm_inference/prompt_builder/prompt_builder.pyi,sha256=67X0MXPRGb_Azifk5fM9lAsQX48rASsQk2gCPikqU5k,4626
88
+ gllm_inference/prompt_builder/prompt_builder.pyi,sha256=w99E5dsQxpJ-1FNEF_WBOt7xovmhp5WzrbTfRQ76K60,5083
89
89
  gllm_inference/prompt_builder/format_strategy/__init__.pyi,sha256=BliNAdrN2yNoQt8muLe1IknuE78UDQys_3L_8_2Tn9E,312
90
90
  gllm_inference/prompt_builder/format_strategy/format_strategy.pyi,sha256=Uay07qR0nMGbrOZ2twEyrIWYRKevBQL9ju_4fVfByyQ,2328
91
91
  gllm_inference/prompt_builder/format_strategy/jinja_format_strategy.pyi,sha256=W8SdOPWPz_U355G8rQwiIQ0Ys78vomUBFEEZiz3AS5k,2270
@@ -111,13 +111,14 @@ gllm_inference/realtime_chat/output_streamer/output_streamer.pyi,sha256=5P9NQ0aJ
111
111
  gllm_inference/request_processor/__init__.pyi,sha256=giEme2WFQhgyKiBZHhSet0_nKSCHwGy-_2p6NRzg0Zc,231
112
112
  gllm_inference/request_processor/lm_request_processor.pyi,sha256=0fy1HyILCVDw6y46E-7tLnQTRYx4ppeRMe0QP6t9Jyw,5990
113
113
  gllm_inference/request_processor/uses_lm_mixin.pyi,sha256=LYHq-zLoXEMel1LfVdYv7W3BZ8WtBLo_WWFjRf10Yto,6512
114
- gllm_inference/schema/__init__.pyi,sha256=4qSVD761xZz1r_GML6g7DDAJhg4nrmG17eYdfocRk-I,2422
114
+ gllm_inference/schema/__init__.pyi,sha256=89GWKdJ6DdPUTem42_Uc-5EsyNcfUJ-WnMVEkagpEwI,2524
115
115
  gllm_inference/schema/activity.pyi,sha256=atrU4OwLesA9FEt1H7K3gsUWYNdOqpI5i2VdWkmo6cs,2367
116
116
  gllm_inference/schema/attachment.pyi,sha256=myJ_cI_h5mwUdvmMrWpSQIwj3nIxe8SD7HxO37o_3D4,4611
117
117
  gllm_inference/schema/code_exec_result.pyi,sha256=WQ-ARoGM9r6nyRX-A0Ro1XKiqrc9R3jRYXZpu_xo5S4,573
118
118
  gllm_inference/schema/config.pyi,sha256=NVmjQK6HipIE0dKSfx12hgIC0O-S1HEcAc-TWlXAF5A,689
119
119
  gllm_inference/schema/enums.pyi,sha256=U-lADk7xNjA5rByem0fo0xDAy9T3GsekY8B5szTlWPQ,2193
120
120
  gllm_inference/schema/events.pyi,sha256=_CKuGNzb3j2Y1dOB2yssFkT_9FQz1AY4J_ApCwKNizU,4743
121
+ gllm_inference/schema/formatter.pyi,sha256=uJ1CZt_DmizfCPHD5deQwm2ftU-zcl2aj5rwJGTPe9c,1312
121
122
  gllm_inference/schema/lm_input.pyi,sha256=HxQiZgY7zcXh_Dw8nK8LSeBTZEHMPZVwmPmnfgSsAbs,197
122
123
  gllm_inference/schema/lm_output.pyi,sha256=N75CIF_2kZRdXKy2jvu9hhqzk5DrCbsHXTrhKqQ-7vo,11667
123
124
  gllm_inference/schema/mcp.pyi,sha256=4SgQ83pEowfWm2p-w9lupV4NayqqVBOy7SuYxIFeWRs,1045
@@ -133,7 +134,7 @@ gllm_inference/utils/io_utils.pyi,sha256=Eg7dvHWdXslTKdjh1j3dG50i7r35XG2zTmJ9XXv
133
134
  gllm_inference/utils/langchain.pyi,sha256=4AwFiVAO0ZpdgmqeC4Pb5NJwBt8vVr0MSUqLeCdTscc,1194
134
135
  gllm_inference/utils/validation.pyi,sha256=OWRZxeVGIuuvNU0LqLGB-9gNmypvbH-LcSJx91rnH1k,453
135
136
  gllm_inference.build/.gitignore,sha256=aEiIwOuxfzdCmLZe4oB1JsBmCUxwG8x-u-HBCV9JT8E,1
136
- gllm_inference_binary-0.5.62.dist-info/METADATA,sha256=opW0bJ-huAATZSyiNRtx4SictbAKXH4ZLOqskzyWrJU,5945
137
- gllm_inference_binary-0.5.62.dist-info/WHEEL,sha256=O_u6PJIQ2pIcyIInxVQ9r-yArMuUZbBIaF1kpYVkYxA,96
138
- gllm_inference_binary-0.5.62.dist-info/top_level.txt,sha256=FpOjtN80F-qVNgbScXSEyqa0w09FYn6301iq6qt69IQ,15
139
- gllm_inference_binary-0.5.62.dist-info/RECORD,,
137
+ gllm_inference_binary-0.5.63.dist-info/METADATA,sha256=fq3iWm6OAw_tevslp6c8_KDa36Y4JVvFq_lzEtuTQwI,5955
138
+ gllm_inference_binary-0.5.63.dist-info/WHEEL,sha256=O_u6PJIQ2pIcyIInxVQ9r-yArMuUZbBIaF1kpYVkYxA,96
139
+ gllm_inference_binary-0.5.63.dist-info/top_level.txt,sha256=FpOjtN80F-qVNgbScXSEyqa0w09FYn6301iq6qt69IQ,15
140
+ gllm_inference_binary-0.5.63.dist-info/RECORD,,