Skip to content

Commit

Permalink
update deps and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
BeautyyuYanli committed Dec 1, 2024
1 parent 80f4255 commit 281d118
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 81 deletions.
4 changes: 2 additions & 2 deletions examples/roleplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from rich import print
from stone_brick.llm.error import GeneratedNotValid
from stone_brick.llm.utils import oai_gen_with_retry_then_validate
from stone_brick.parser.xml import tags_from_text
from stone_brick.parser import flat_xml_tags_from_text

from prompt_bottle import PromptBottle

Expand Down Expand Up @@ -190,7 +190,7 @@ async def try_generate(
)

def validator(text: str):
tags = tags_from_text(text, [tag.value for tag in LogType])
tags = flat_xml_tags_from_text(text, [tag.value for tag in LogType])
for item in tags:
if isinstance(item, tuple):
return LogType(item[0]), item[1]
Expand Down
105 changes: 34 additions & 71 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "prompt_bottle"
version = "0.1.4"
version = "0.1.5"
description = "LLM-targeted template engine, built upon Jinja"
authors = [
{name = "Yanli",email = "[email protected]"},
Expand All @@ -9,7 +9,7 @@ dependencies = [
"openai>=1.51.2",
"jinja2>=3.1.4",
"PyYAML>=6.0.2",
"stone-brick-toolkit~=0.5.0"
"stone-brick-toolkit>=0.6.1,<1.0.0"
]
requires-python = ">=3.9"
readme = "README.md"
Expand All @@ -31,6 +31,11 @@ build-backend = "pdm.backend"
[tool.pdm]
distribution = true

[tool.pdm.dev-dependencies]
dev = [
"rich>=13.9.4",
"ruff>=0.8.1",
]
[tool.pyright]
venvPath = ".venv"

Expand Down
8 changes: 4 additions & 4 deletions src/prompt_bottle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
)

__all__ = [
"PromptBottle",
"simple_bottle",
"PBTag",
"pb_tag",
"PromptBottle",
"pb_audio",
"pb_img_url",
"pb_mp3_audio",
"pb_tag",
"pb_wav_audio",
"pb_audio",
"simple_bottle",
]
4 changes: 2 additions & 2 deletions src/prompt_bottle/bottle.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from openai.types.chat.chat_completion_assistant_message_param import (
ContentArrayOfContentPart,
)
from stone_brick.parser.xml import tags_from_text
from stone_brick.parser.xml import flat_xml_tags_from_text

from prompt_bottle.tags.convert_to import PB_TAG_TO_OPENAI, to_text_part
from prompt_bottle.tags.tags import PBTag
Expand Down Expand Up @@ -111,7 +111,7 @@ def render_text(
text = Template(text).render(**kwargs)
parts: List[ChatCompletionContentPartParam] = []

tags = tags_from_text(text, [tag.value for tag in PBTag])
tags = flat_xml_tags_from_text(text, [tag.value for tag in PBTag])
for tag in tags:
if isinstance(tag, tuple):
name, content = tag
Expand Down

0 comments on commit 281d118

Please sign in to comment.