Skip to content

Commit b065eef

Browse files
committed
fix StrEnum back compabilty and bump versoin
1 parent 1b3aaf3 commit b065eef

File tree

4 files changed

+31
-24
lines changed

4 files changed

+31
-24
lines changed

pdm.lock

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[project]
22
name = "prompt_bottle"
3-
version = "0.3.1"
3+
version = "0.3.2"
44
description = "Prompt template engine, built upon Jinja"
55
authors = [
66
{name = "Yanli",email = "mail@yanli.one"},
77
]
88
dependencies = [
99
"qwq-tag>=0.1.2",
1010
"minijinja>=2.11.0",
11-
"pydantic-ai-slim>=0.7.2"
11+
"pydantic-ai-slim>=1.0.2"
1212
]
1313
requires-python = ">=3.10"
1414
readme = "README.md"

src/prompt_bottle/pipeline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def stage_split_history(
5050
isinstance(tag, QwqTag)
5151
and tag.name == "div"
5252
and (role := tag.attr.get("role", None))
53-
and role in RolesType
53+
and any(x.value == role for x in RolesType)
5454
):
5555
yield (
5656
RolesType(role),
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1-
from typing import Any
1+
from typing import TYPE_CHECKING, Any
22

33
from pydantic_ai.messages import ModelMessage
44

5+
if TYPE_CHECKING:
6+
from openai.types.chat.chat_completion_message_param import (
7+
ChatCompletionMessageParam,
8+
)
59

6-
async def to_openai_chat(source: list[ModelMessage], **model_kwargs: Any):
7-
from pydantic_ai.models.openai import OpenAIModel
10+
11+
async def to_openai_chat(
12+
source: list[ModelMessage], **model_kwargs: Any
13+
) -> "list[ChatCompletionMessageParam]":
14+
from pydantic_ai.models.openai import OpenAIChatModel
815

916
if "model_name" not in model_kwargs:
1017
model_kwargs["model_name"] = "gpt-4o"
1118

12-
return await OpenAIModel(**model_kwargs)._map_messages(source) # type: ignore
19+
return await OpenAIChatModel(**model_kwargs)._map_messages(source)

0 commit comments

Comments
 (0)