hamtaa-texttools 1.0.6__py3-none-any.whl → 1.0.8__py3-none-any.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.
- {hamtaa_texttools-1.0.6.dist-info → hamtaa_texttools-1.0.8.dist-info}/METADATA +13 -22
- hamtaa_texttools-1.0.8.dist-info/RECORD +30 -0
- texttools/tools/async_the_tool.py +246 -140
- texttools/tools/internals/async_operator.py +81 -212
- texttools/tools/internals/base_operator.py +85 -0
- texttools/tools/internals/formatters.py +24 -0
- texttools/tools/internals/operator.py +32 -150
- texttools/tools/internals/prompt_loader.py +3 -12
- texttools/tools/the_tool.py +163 -283
- hamtaa_texttools-1.0.6.dist-info/RECORD +0 -30
- texttools/formatters/base_formatter.py +0 -33
- texttools/formatters/user_merge_formatter.py +0 -30
- {hamtaa_texttools-1.0.6.dist-info → hamtaa_texttools-1.0.8.dist-info}/WHEEL +0 -0
- {hamtaa_texttools-1.0.6.dist-info → hamtaa_texttools-1.0.8.dist-info}/licenses/LICENSE +0 -0
- {hamtaa_texttools-1.0.6.dist-info → hamtaa_texttools-1.0.8.dist-info}/top_level.txt +0 -0
- /texttools/prompts/{ner_extractor.yaml → extract_entities.yaml} +0 -0
- /texttools/prompts/{keyword_extractor.yaml → extract_keywords.yaml} +0 -0
- /texttools/prompts/{question_merger.yaml → merge_questions.yaml} +0 -0
- /texttools/prompts/{rewriter.yaml → rewrite.yaml} +0 -0
- /texttools/prompts/{summarizer.yaml → summarize.yaml} +0 -0
- /texttools/prompts/{translator.yaml → translate.yaml} +0 -0
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
hamtaa_texttools-1.0.6.dist-info/licenses/LICENSE,sha256=Hb2YOBKy2MJQLnyLrX37B4ZVuac8eaIcE71SvVIMOLg,1082
|
|
2
|
-
texttools/__init__.py,sha256=v3tQCH_Cjj47fCpuhK6sKSVAqEjNkc-cZbY4OJa4IZw,202
|
|
3
|
-
texttools/batch/__init__.py,sha256=q50JsQsmQGp_8RW0KNasYeYWVV0R4FUNZ-ujXwEJemY,143
|
|
4
|
-
texttools/batch/batch_manager.py,sha256=leVIFkR-3HpDkQi_MK3TgFNnHYsCN-wbS4mTWoPmO3c,8828
|
|
5
|
-
texttools/batch/batch_runner.py,sha256=cgiCYLIBQQC0dBWM8_lVP9c5QLJoAmS2ijMtp0p3U2o,10313
|
|
6
|
-
texttools/formatters/base_formatter.py,sha256=xxnbujAr01NqZ49Y61LVFpIbj6kTEmV6JiUH_qCsIFk,1180
|
|
7
|
-
texttools/formatters/user_merge_formatter.py,sha256=U_d7npTkC9QDgtEFjAjIuDlPfxVj3S1RyziidKqjciw,1086
|
|
8
|
-
texttools/prompts/README.md,sha256=rclMaCV1N8gT1KcpZu0-ka0dKGNg2f1CEcRMdQkgQOc,1379
|
|
9
|
-
texttools/prompts/categorizer.yaml,sha256=GMqIIzQFhgnlpkgU1qi3FAD3mD4A2jiWD5TilQ2XnnE,1204
|
|
10
|
-
texttools/prompts/is_question.yaml,sha256=d0-vKRbXWkxvO64ikvxRjEmpAXGpCYIPGhgexvPPjws,471
|
|
11
|
-
texttools/prompts/keyword_extractor.yaml,sha256=0O7ypL_OsEOxtvlQ2CZjnsv9637DJwAKprZsf9Vo2_s,769
|
|
12
|
-
texttools/prompts/ner_extractor.yaml,sha256=KiKjeDpHaeh3JVtZ6q1pa3k4DYucUIU9WnEcRTCA-SE,651
|
|
13
|
-
texttools/prompts/question_merger.yaml,sha256=0J85GvTirZB4ELwH3sk8ub_WcqqpYf6PrMKr3djlZeo,1792
|
|
14
|
-
texttools/prompts/rewriter.yaml,sha256=LO7He_IA3MZKz8a-LxH9DHJpOjpYwaYN1pbjp1Y0tFo,5392
|
|
15
|
-
texttools/prompts/run_custom.yaml,sha256=38OkCoVITbuuS9c08UZSP1jZW4WjSmRIi8fR0RAiPu4,108
|
|
16
|
-
texttools/prompts/subject_to_question.yaml,sha256=C7x7rNNm6U_ZG9HOn6zuzYOtvJUZ2skuWbL1-aYdd3E,1147
|
|
17
|
-
texttools/prompts/summarizer.yaml,sha256=o6rxGPfWtZd61Duvm8NVvCJqfq73b-wAuMSKR6UYUqY,459
|
|
18
|
-
texttools/prompts/text_to_question.yaml,sha256=UheKYpDn6iyKI8NxunHZtFpNyfCLZZe5cvkuXpurUJY,783
|
|
19
|
-
texttools/prompts/translator.yaml,sha256=mGT2uBCei6uucWqVbs4silk-UV060v3G0jnt0P6sr50,634
|
|
20
|
-
texttools/tools/__init__.py,sha256=hG1I28Q7BJ1Dbs95x6QMKXdsAlC5Eh_tqC-EbAibwiU,114
|
|
21
|
-
texttools/tools/async_the_tool.py,sha256=BQdk0kyMme4fQz7aL5gcLvH7xEYYpfAaykM5wS9nonY,8785
|
|
22
|
-
texttools/tools/the_tool.py,sha256=Yzt9JBK0bsMvDdsUXuWporTqqR497AmIQktTkM3RjgM,19334
|
|
23
|
-
texttools/tools/internals/async_operator.py,sha256=bzXec7K_T_xwJ59zFkfuJ-zaadt6nfXjW1S4BmoHaFM,10207
|
|
24
|
-
texttools/tools/internals/operator.py,sha256=ZoPL77k_voerm7vOorHU3UkC688R_KJJkQ8GoO-6gmc,10021
|
|
25
|
-
texttools/tools/internals/output_models.py,sha256=Rf2x-UuGlmQHrvYIqnD11YuzMH_mPuir62HoMJQa2uk,1528
|
|
26
|
-
texttools/tools/internals/prompt_loader.py,sha256=_4Tpu5aykKUwqcQEK88HPMlRvmQiokk0nP2TKmWZ924,2260
|
|
27
|
-
hamtaa_texttools-1.0.6.dist-info/METADATA,sha256=GPACtX50UntjeIHgi2LNL2jdPVHG3XFVR0PhU-rWpxc,7506
|
|
28
|
-
hamtaa_texttools-1.0.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
29
|
-
hamtaa_texttools-1.0.6.dist-info/top_level.txt,sha256=5Mh0jIxxZ5rOXHGJ6Mp-JPKviywwN0MYuH0xk5bEWqE,10
|
|
30
|
-
hamtaa_texttools-1.0.6.dist-info/RECORD,,
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
from abc import ABC, abstractmethod
|
|
2
|
-
from typing import Any
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class BaseFormatter(ABC):
|
|
6
|
-
"""
|
|
7
|
-
Adapter to convert a conversation into a specific LLM API's input format.
|
|
8
|
-
|
|
9
|
-
Concrete implementations transform standardized messages (e.g., list[dict]) into the
|
|
10
|
-
exact payload required by a provider (e.g., OpenAI's message list, a single string, etc.).
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
@abstractmethod
|
|
14
|
-
def format(
|
|
15
|
-
self,
|
|
16
|
-
messages: Any,
|
|
17
|
-
) -> Any:
|
|
18
|
-
"""
|
|
19
|
-
Transform the input messages into a provider-specific payload.
|
|
20
|
-
|
|
21
|
-
Args:
|
|
22
|
-
messages: The input conversation. While often a list of dicts with
|
|
23
|
-
'role' and 'content' keys, the exact type and structure may vary
|
|
24
|
-
by implementation.
|
|
25
|
-
|
|
26
|
-
Returns:
|
|
27
|
-
A payload in the format expected by the target LLM API. This could be:
|
|
28
|
-
- A list of role-content dictionaries (e.g., for OpenAI)
|
|
29
|
-
- A single formatted string (e.g., for completion-style APIs)
|
|
30
|
-
- A complex dictionary with additional parameters
|
|
31
|
-
- Any other provider-specific data structure
|
|
32
|
-
"""
|
|
33
|
-
pass
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
from texttools.formatters.base_formatter import BaseFormatter
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class UserMergeFormatter(BaseFormatter):
|
|
5
|
-
"""
|
|
6
|
-
Merges consecutive user messages into a single message, separated by newlines.
|
|
7
|
-
|
|
8
|
-
This is useful for condensing a multi-turn user input into a single coherent
|
|
9
|
-
message for the LLM. Assistant and system messages are left unchanged and
|
|
10
|
-
act as separators between user message groups.
|
|
11
|
-
|
|
12
|
-
Raises:
|
|
13
|
-
ValueError: If the input messages have invalid structure or roles.
|
|
14
|
-
"""
|
|
15
|
-
|
|
16
|
-
def format(self, messages: list[dict[str, str]]) -> list[dict[str, str]]:
|
|
17
|
-
merged: list[dict[str, str]] = []
|
|
18
|
-
|
|
19
|
-
for message in messages:
|
|
20
|
-
role, content = message["role"], message["content"].strip()
|
|
21
|
-
|
|
22
|
-
# Merge with previous user turn
|
|
23
|
-
if merged and role == "user" and merged[-1]["role"] == "user":
|
|
24
|
-
merged[-1]["content"] += "\n" + content
|
|
25
|
-
|
|
26
|
-
# Otherwise, start a new turn
|
|
27
|
-
else:
|
|
28
|
-
merged.append({"role": role, "content": content})
|
|
29
|
-
|
|
30
|
-
return merged
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|