promptbuilder 0.4.32__tar.gz → 0.4.33__tar.gz

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.
Files changed (40) hide show
  1. {promptbuilder-0.4.32/promptbuilder.egg-info → promptbuilder-0.4.33}/PKG-INFO +1 -1
  2. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder/agent/agent.py +2 -2
  3. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder/agent/context.py +12 -2
  4. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder/llm_client/vertex_client.py +9 -0
  5. {promptbuilder-0.4.32 → promptbuilder-0.4.33/promptbuilder.egg-info}/PKG-INFO +1 -1
  6. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/setup.py +1 -1
  7. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/LICENSE +0 -0
  8. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/MANIFEST.in +0 -0
  9. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/Readme.md +0 -0
  10. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder/__init__.py +0 -0
  11. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder/agent/__init__.py +0 -0
  12. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder/agent/tool.py +0 -0
  13. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder/agent/utils.py +0 -0
  14. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder/embeddings.py +0 -0
  15. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder/llm_client/__init__.py +0 -0
  16. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder/llm_client/aisuite_client.py +0 -0
  17. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder/llm_client/anthropic_client.py +0 -0
  18. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder/llm_client/base_client.py +0 -0
  19. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder/llm_client/bedrock_client.py +0 -0
  20. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder/llm_client/config.py +0 -0
  21. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder/llm_client/exceptions.py +0 -0
  22. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder/llm_client/google_client.py +0 -0
  23. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder/llm_client/litellm_client.py +0 -0
  24. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder/llm_client/logfire_decorators.py +0 -0
  25. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder/llm_client/main.py +0 -0
  26. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder/llm_client/openai_client.py +0 -0
  27. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder/llm_client/types.py +0 -0
  28. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder/llm_client/utils.py +0 -0
  29. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder/prompt_builder.py +0 -0
  30. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder.egg-info/SOURCES.txt +0 -0
  31. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder.egg-info/dependency_links.txt +0 -0
  32. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder.egg-info/requires.txt +0 -0
  33. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/promptbuilder.egg-info/top_level.txt +0 -0
  34. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/pyproject.toml +0 -0
  35. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/setup.cfg +0 -0
  36. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/tests/test_llm_client.py +0 -0
  37. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/tests/test_llm_client_async.py +0 -0
  38. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/tests/test_timeout_google.py +0 -0
  39. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/tests/test_timeout_litellm.py +0 -0
  40. {promptbuilder-0.4.32 → promptbuilder-0.4.33}/tests/test_timeout_openai.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: promptbuilder
3
- Version: 0.4.32
3
+ Version: 0.4.33
4
4
  Summary: Library for building prompts for LLMs
5
5
  Home-page: https://github.com/kapulkin/promptbuilder
6
6
  Author: Kapulkin Stanislav
@@ -49,7 +49,7 @@ class Agent(Generic[MessageType, ContextType]):
49
49
  return messages
50
50
 
51
51
  async def _answer_with_llm(self, **kwargs: Any) -> Response:
52
- messages = self._formatted_messages(self.context.dialog_history.last_messages())
52
+ messages = self._formatted_messages(self.context.dialog_history.last_content_messages())
53
53
  return await run_async(self.llm_client.create,
54
54
  messages=messages,
55
55
  system_message=self.system_message(**kwargs),
@@ -73,7 +73,7 @@ class AgentRouter(Agent[MessageType, ContextType]):
73
73
  callable_trs = [self.tools.get(name) or self.routes.get(name) for name in self.tr_names if name not in trs_to_exclude]
74
74
  trs = [callable_tr.tool for callable_tr in callable_trs]
75
75
 
76
- messages = self._formatted_messages(self.context.dialog_history.last_messages())
76
+ messages = self._formatted_messages(self.context.dialog_history.last_content_messages())
77
77
  response = await run_async(self.llm_client.create,
78
78
  messages=messages,
79
79
  system_message=self.system_message(callable_trs=callable_trs),
@@ -6,12 +6,15 @@ from typing import Any, TypeVar, Generic
6
6
  MessageType = TypeVar("MessageType", bound=Any)
7
7
 
8
8
  class DialogHistory(Generic[MessageType]):
9
- def last_messages(self, n: int = 0) -> list[Content]:
9
+ def last_content_messages(self, n: int = 0) -> list[Content]:
10
10
  raise NotImplementedError("Subclasses must implement this method")
11
11
 
12
12
  def add_message(self, message: MessageType):
13
13
  raise NotImplementedError("Subclasses must implement this method")
14
14
 
15
+ def last_messages(self, n: int = 0) -> list[MessageType]:
16
+ raise NotImplementedError("Subclasses must implement this method")
17
+
15
18
  def clear(self):
16
19
  raise NotImplementedError("Subclasses must implement this method")
17
20
 
@@ -19,12 +22,19 @@ class InMemoryDialogHistory(DialogHistory[Content]):
19
22
  def __init__(self):
20
23
  self.messages: list[Content] = []
21
24
 
22
- def last_messages(self, n: int = 0) -> list[Content]:
25
+ def last_content_messages(self, n: int = 0) -> list[Content]:
26
+ if n == 0:
27
+ return self.messages
23
28
  return self.messages[-n:]
24
29
 
25
30
  def add_message(self, message: Content):
26
31
  self.messages.append(message)
27
32
 
33
+ def last_messages(self, n: int = 0) -> list[Content]:
34
+ if n == 0:
35
+ return self.messages
36
+ return self.messages[-n:]
37
+
28
38
  def clear(self):
29
39
  self.messages = []
30
40
 
@@ -198,6 +198,15 @@ class VertexLLMClient(BaseLLMClient):
198
198
  v_messages = _to_vertex_content(messages)
199
199
  GenerationConfig = getattr(importlib.import_module("vertexai.generative_models"), "GenerationConfig")
200
200
  gen_cfg = GenerationConfig(max_output_tokens=max_tokens or self.default_max_tokens)
201
+
202
+ # Handle thinking config
203
+ if thinking_config is None:
204
+ thinking_config = self.default_thinking_config
205
+ if thinking_config is not None:
206
+ # Vertex AI supports thinking via response_logprobs and logprobs parameters
207
+ # but the exact implementation may vary - for now, we'll store it for potential future use
208
+ pass
209
+
201
210
  req_opts: dict[str, Any] | None = {}
202
211
  if timeout is not None:
203
212
  req_opts["timeout"] = timeout
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: promptbuilder
3
- Version: 0.4.32
3
+ Version: 0.4.33
4
4
  Summary: Library for building prompts for LLMs
5
5
  Home-page: https://github.com/kapulkin/promptbuilder
6
6
  Author: Kapulkin Stanislav
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="promptbuilder",
5
- version="0.4.32",
5
+ version="0.4.33",
6
6
  packages=find_packages(),
7
7
  install_requires=[
8
8
  "pydantic",
File without changes
File without changes
File without changes