LLM-Bridge 2.4.3__tar.gz → 2.4.5__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 (106) hide show
  1. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/PKG-INFO +1 -1
  2. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/implementations/gemini/gemini_response_handler.py +13 -6
  3. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/logic/chat_generate/model_client_factory/gemini_client_factory.py +2 -14
  4. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/logic/message_process/message_processor.py +12 -1
  5. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/pyproject.toml +1 -1
  6. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/usage/single/config.py +4 -5
  7. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/uv.lock +1 -1
  8. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/.gitattributes +0 -0
  9. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/.github/workflows/pypi-publish.yaml +0 -0
  10. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/.github/workflows/python-test.yaml +0 -0
  11. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/.gitignore +0 -0
  12. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/.run/batch.run.xml +0 -0
  13. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/.run/pytest.run.xml +0 -0
  14. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/.run/single.run.xml +0 -0
  15. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/LICENSE +0 -0
  16. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/README.md +0 -0
  17. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/__init__.py +0 -0
  18. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/__init__.py +0 -0
  19. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/chat_client.py +0 -0
  20. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/implementations/__init__.py +0 -0
  21. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/implementations/claude/__init__.py +0 -0
  22. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/implementations/claude/claude_response_handler.py +0 -0
  23. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/implementations/claude/claude_token_counter.py +0 -0
  24. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/implementations/claude/non_stream_claude_client.py +0 -0
  25. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/implementations/claude/stream_claude_client.py +0 -0
  26. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/implementations/gemini/__init__.py +0 -0
  27. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/implementations/gemini/gemini_token_counter.py +0 -0
  28. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/implementations/gemini/non_stream_gemini_client.py +0 -0
  29. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/implementations/gemini/stream_gemini_client.py +0 -0
  30. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/implementations/http_error.py +0 -0
  31. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/implementations/openai_completion/__init__.py +0 -0
  32. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/implementations/openai_completion/non_stream_openai_completion_client.py +0 -0
  33. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/implementations/openai_completion/stream_openai_completion_client.py +0 -0
  34. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/implementations/openai_responses/__init__.py +0 -0
  35. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/implementations/openai_responses/non_stream_openai_responses_client.py +0 -0
  36. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/implementations/openai_responses/openai_responses_response_handler.py +0 -0
  37. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/implementations/openai_responses/stream_openai_responses_client.py +0 -0
  38. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/implementations/xai/__init__.py +0 -0
  39. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/implementations/xai/non_stream_xai_client.py +0 -0
  40. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/implementations/xai/stream_xai_client.py +0 -0
  41. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/model_client/__init__.py +0 -0
  42. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/model_client/claude_client.py +0 -0
  43. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/model_client/gemini_client.py +0 -0
  44. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/model_client/openai_completion_client.py +0 -0
  45. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/model_client/openai_responses_client.py +0 -0
  46. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/client/model_client/xai_client.py +0 -0
  47. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/logic/__init__.py +0 -0
  48. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/logic/chat_generate/__init__.py +0 -0
  49. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/logic/chat_generate/chat_client_factory.py +0 -0
  50. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/logic/chat_generate/chat_message_converter.py +0 -0
  51. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/logic/chat_generate/media_processor.py +0 -0
  52. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/logic/chat_generate/model_client_factory/__init__.py +0 -0
  53. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/logic/chat_generate/model_client_factory/claude_client_factory.py +0 -0
  54. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/logic/chat_generate/model_client_factory/openai_completion_client_factory.py +0 -0
  55. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/logic/chat_generate/model_client_factory/openai_responses_client_factory.py +0 -0
  56. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/logic/chat_generate/model_client_factory/xai_client_factory.py +0 -0
  57. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/logic/chat_generate/model_message_converter/__init__.py +0 -0
  58. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/logic/chat_generate/model_message_converter/claude_message_converter.py +0 -0
  59. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/logic/chat_generate/model_message_converter/gemini_message_converter.py +0 -0
  60. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/logic/chat_generate/model_message_converter/gemini_mime_types.py +0 -0
  61. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/logic/chat_generate/model_message_converter/openai_completion_message_converter.py +0 -0
  62. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/logic/chat_generate/model_message_converter/openai_responses_message_converter.py +0 -0
  63. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/logic/chat_generate/model_message_converter/xai_message_converter.py +0 -0
  64. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/logic/file_fetch.py +0 -0
  65. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/logic/message_process/__init__.py +0 -0
  66. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/logic/message_process/code_file_extensions.py +0 -0
  67. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/logic/message_process/document_processor.py +0 -0
  68. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/logic/message_process/file_type_checker.py +0 -0
  69. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/logic/model_prices.py +0 -0
  70. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/resources/__init__.py +0 -0
  71. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/resources/model_prices.json +0 -0
  72. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/type/__init__.py +0 -0
  73. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/type/chat_response.py +0 -0
  74. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/type/message.py +0 -0
  75. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/type/model_message/__init__.py +0 -0
  76. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/type/model_message/claude_message.py +0 -0
  77. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/type/model_message/gemini_message.py +0 -0
  78. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/type/model_message/openai_completion_message.py +0 -0
  79. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/type/model_message/openai_responses_message.py +0 -0
  80. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/type/model_message/xai_message.py +0 -0
  81. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/llm_bridge/type/serializer.py +0 -0
  82. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/tests/__init__.py +0 -0
  83. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/tests/logic/__init__.py +0 -0
  84. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/tests/logic/chat_generate/__init__.py +0 -0
  85. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/tests/logic/chat_generate/model_message_converter/__init__.py +0 -0
  86. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/tests/logic/chat_generate/model_message_converter/claude_message_converter_test.py +0 -0
  87. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/tests/logic/chat_generate/model_message_converter/gemini_message_converter_test.py +0 -0
  88. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/tests/logic/chat_generate/model_message_converter/openai_completion_message_converter_test.py +0 -0
  89. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/tests/logic/chat_generate/model_message_converter/openai_responses_message_converter_test.py +0 -0
  90. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/tests/logic/chat_generate/model_message_converter/xai_message_converter_test.py +0 -0
  91. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/tests/logic/message_factory.py +0 -0
  92. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/tests/logic/message_process/__init__.py +0 -0
  93. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/tests/logic/message_process/file_type_checker_test.py +0 -0
  94. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/tests/logic/message_process/message_processor_test.py +0 -0
  95. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/tests/logic/model_prices_test.py +0 -0
  96. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/usage/.env.example +0 -0
  97. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/usage/__init__.py +0 -0
  98. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/usage/batch/__init__.py +0 -0
  99. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/usage/batch/batch.py +0 -0
  100. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/usage/batch/config.py +0 -0
  101. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/usage/example_file_urls.py +0 -0
  102. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/usage/keys.py +0 -0
  103. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/usage/messages.py +0 -0
  104. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/usage/single/__init__.py +0 -0
  105. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/usage/single/single.py +0 -0
  106. {llm_bridge-2.4.3 → llm_bridge-2.4.5}/usage/workflow.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: LLM-Bridge
3
- Version: 2.4.3
3
+ Version: 2.4.5
4
4
  Summary: A library that wraps multiple LLM providers into a consistent API while using each provider's native SDK internally, supporting multimodal I/O, file processing, and stream output.
5
5
  Author-email: windsnow1025 <windsnow1025@gmail.com>
6
6
  License-Expression: MIT
@@ -11,6 +11,7 @@ from llm_bridge.type.chat_response import ChatResponse, File
11
11
  class GeminiResponseHandler:
12
12
  def __init__(self):
13
13
  self.prev_cumulative_output_tokens: int = 0
14
+ self.grounding_sources: dict[str, str] = {}
14
15
 
15
16
  async def process_gemini_response(
16
17
  self,
@@ -40,12 +41,14 @@ class GeminiResponseHandler:
40
41
  text += part.text
41
42
  # Code
42
43
  if part.executable_code is not None:
43
- code += part.executable_code.code
44
+ if part.executable_code.code:
45
+ code += part.executable_code.code
44
46
  # Code Output
45
47
  if part.code_execution_result is not None:
46
- code_output += part.code_execution_result.output
48
+ if part.code_execution_result.output:
49
+ code_output += part.code_execution_result.output
47
50
  # File
48
- if part.inline_data is not None:
51
+ if part.inline_data is not None and not part.thought:
49
52
  mime_type = part.inline_data.mime_type
50
53
  extension = mimetypes.guess_extension(mime_type) or ""
51
54
  file = File(
@@ -61,10 +64,14 @@ class GeminiResponseHandler:
61
64
  if search_entry_point := grounding_metadata.search_entry_point:
62
65
  display = search_entry_point.rendered_content
63
66
  if grounding_metadata.grounding_chunks:
64
- text += "\n\n# Grounding Sources:\n"
65
- for i, chunk in enumerate(grounding_metadata.grounding_chunks, start=1):
67
+ for chunk in grounding_metadata.grounding_chunks:
66
68
  if chunk.web:
67
- text += f"{i}. [{chunk.web.title}]({chunk.web.uri})\n"
69
+ self.grounding_sources[chunk.web.uri] = chunk.web.title
70
+ if candidates[0].finish_reason:
71
+ if self.grounding_sources:
72
+ text += "\n\n# Grounding Sources:\n"
73
+ for i, (uri, title) in enumerate(self.grounding_sources.items(), start=1):
74
+ text += f"{i}. [{title}]({uri})\n"
68
75
 
69
76
  output_tokens = cumulative_output_tokens - self.prev_cumulative_output_tokens
70
77
  self.prev_cumulative_output_tokens = cumulative_output_tokens
@@ -7,20 +7,8 @@ from google.genai.types import Modality, MediaResolution
7
7
  from llm_bridge.client.implementations.gemini.non_stream_gemini_client import NonStreamGeminiClient
8
8
  from llm_bridge.client.implementations.gemini.stream_gemini_client import StreamGeminiClient
9
9
  from llm_bridge.logic.chat_generate.chat_message_converter import convert_messages_to_gemini
10
- from llm_bridge.logic.message_process.file_type_checker import get_file_type
11
- from llm_bridge.logic.message_process.message_processor import extract_system_message
12
- from llm_bridge.type.message import Message, ContentType
13
-
14
-
15
- async def contains_audio_or_video(messages: list[Message]) -> bool:
16
- for message in messages:
17
- for content_item in message.contents:
18
- if content_item.type != ContentType.File:
19
- continue
20
- file_type, _ = await get_file_type(content_item.data)
21
- if file_type in ("audio", "video"):
22
- return True
23
- return False
10
+ from llm_bridge.logic.message_process.message_processor import extract_system_message, contains_audio_or_video
11
+ from llm_bridge.type.message import Message
24
12
 
25
13
 
26
14
  async def create_gemini_client(
@@ -1,5 +1,5 @@
1
1
  from llm_bridge.logic.message_process import document_processor
2
- from llm_bridge.logic.message_process.file_type_checker import get_filename_without_timestamp
2
+ from llm_bridge.logic.message_process.file_type_checker import get_file_type, get_filename_without_timestamp
3
3
  from llm_bridge.type.message import Message, Role, ContentType
4
4
 
5
5
 
@@ -26,3 +26,14 @@ def extract_system_message(messages: list[Message]) -> str:
26
26
  del messages[0]
27
27
 
28
28
  return system_message
29
+
30
+
31
+ async def contains_audio_or_video(messages: list[Message]) -> bool:
32
+ for message in messages:
33
+ for content_item in message.contents:
34
+ if content_item.type != ContentType.File:
35
+ continue
36
+ file_type, _ = await get_file_type(content_item.data)
37
+ if file_type in ("audio", "video"):
38
+ return True
39
+ return False
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "LLM-Bridge"
7
- version = "2.4.3"
7
+ version = "2.4.5"
8
8
  dependencies = [
9
9
  "fastapi",
10
10
  "httpx",
@@ -178,20 +178,19 @@ messages = [
178
178
  # model = "gpt-audio-1.5"
179
179
  # model = "gemini-4-carbon"
180
180
  # model = "gemini-4-argon"
181
- # model = "gemini-4-hydrogen"
181
+ model = "gemini-4-hydrogen"
182
182
  # model = "gemini-3-pro-image"
183
183
  # model = "gemini-3.1-flash-image"
184
- # model = "gemini-3.5-flash"
185
- model = "claude-fable-5-2"
184
+ # model = "claude-fable-5-2"
186
185
  # model = "claude-opus-4-6"
187
186
  # model = "grok-4.6"
188
187
 
189
- # api_type = "Vertex AI"
188
+ api_type = "Vertex AI"
190
189
  # api_type = "Google AI Studio Free Tier"
191
190
  # api_type = "Google AI Studio"
192
191
  # api_type = "OpenAI"
193
192
  # api_type = "OpenAI-Azure"
194
- api_type = "Claude"
193
+ # api_type = "Claude"
195
194
  # api_type = "Grok"
196
195
 
197
196
  temperature = 0
@@ -798,7 +798,7 @@ wheels = [
798
798
 
799
799
  [[package]]
800
800
  name = "llm-bridge"
801
- version = "2.4.3"
801
+ version = "2.4.5"
802
802
  source = { editable = "." }
803
803
  dependencies = [
804
804
  { name = "anthropic" },
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