Skip to content

Fix and new features#51

Merged
atomiechen merged 27 commits intomainfrom
dev
Aug 16, 2025
Merged

Fix and new features#51
atomiechen merged 27 commits intomainfrom
dev

Conversation

@atomiechen
Copy link
Owner

Added

  • feat(PromptConverter): add tool and array keywords for convenience
  • feat(CacheManager): support only_load option
  • feat(CacheManager): add ensure_dumped method
    • Example scenario: The decorated function can be called multiple times, but we only want to check files existence without loading them multiple times (which is the case of cache method).
  • feat(OpenAIClient): ensure only client-wide credentials are used; API runtime credentials are ignored
  • feat(OpenAIClient): support ensure_client_credentials in constructor and load obj
  • feat(hprompt): support audio input (input_audio type)
  • feat(hprompt): add methods for adding content parts to certain message
    • content parts: text, image, audio
  • Reasoning Support:
    • feat(hprompt): now supports sub header ($$reasoning_content$$/$$content$$) for storing reasoning tokens
    • add stream_chat_with_reasoning and astream_chat_with_reasoning for streaming responses with reasoning
    • ChatPrompt: add result_reasoning to get the reasoning content string from the last message
  • add option RunConfig.overwrite_if_exists: default do not overwrite already existing output paths

Fixed

  • PromptConverter:
    • fix extra properties in header: should escape quotes and new lines
    • fix msgs_replace_variables(): return a deep copy when not inplace. The previous behavior returns a shallow list copy, which may cause unexpected behavior when modifying the returned object.
  • ChatPrompt: ensure result_str always return a str; if content in last message is a list, return the text part if exists

Changed

  • PromptConverter.msgs2raw() (ChatPrompt dump): default use tool and array keywords (instead of type="tool_calls" and type="content_array") in the dumped text. See above new feature of introducing tool and array keywords.
  • ChatPrompt.add_message(): now only accepts keyword arguments
  • Stream chunk type:
    • RunConfig.on_chunk(): now must receive a typed dict ChatChunkUnified with keys: role, content, reasoning_content, and tool_call
    • stream_chat_all() / astream_chat_all(): now also yield the typed dict ChatChunkUnified
  • remove all DictProxy definitions and change to TypedDict, please use TypedDict for better type checking and editor support.

httpx 0.28.0 incompatibility fixed in respx 0.22.0
if content in last message is a list, return the text part if exists
@atomiechen atomiechen merged commit a0646ce into main Aug 16, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant