LLM-Bridge 1.10.3__tar.gz → 1.11.0__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 (68) hide show
  1. {llm_bridge-1.10.3 → llm_bridge-1.11.0/LLM_Bridge.egg-info}/PKG-INFO +2 -2
  2. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/LLM_Bridge.egg-info/requires.txt +1 -1
  3. {llm_bridge-1.10.3/LLM_Bridge.egg-info → llm_bridge-1.11.0}/PKG-INFO +2 -2
  4. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/client/implementations/gemini/gemini_token_counter.py +6 -1
  5. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/logic/chat_generate/chat_client_factory.py +13 -2
  6. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/logic/chat_generate/model_client_factory/gemini_client_factory.py +26 -10
  7. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/resources/model_prices.json +19 -1
  8. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/pyproject.toml +2 -2
  9. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/LICENSE +0 -0
  10. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/LLM_Bridge.egg-info/SOURCES.txt +0 -0
  11. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/LLM_Bridge.egg-info/dependency_links.txt +0 -0
  12. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/LLM_Bridge.egg-info/top_level.txt +0 -0
  13. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/MANIFEST.in +0 -0
  14. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/README.md +0 -0
  15. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/__init__.py +0 -0
  16. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/client/__init__.py +0 -0
  17. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/client/chat_client.py +0 -0
  18. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/client/implementations/__init__.py +0 -0
  19. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/client/implementations/claude/__init__.py +0 -0
  20. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/client/implementations/claude/claude_stream_response_handler.py +0 -0
  21. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/client/implementations/claude/claude_token_counter.py +0 -0
  22. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/client/implementations/claude/non_stream_claude_client.py +0 -0
  23. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/client/implementations/claude/stream_claude_client.py +0 -0
  24. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/client/implementations/gemini/__init__.py +0 -0
  25. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/client/implementations/gemini/gemini_response_handler.py +0 -0
  26. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/client/implementations/gemini/non_stream_gemini_client.py +0 -0
  27. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/client/implementations/gemini/stream_gemini_client.py +0 -0
  28. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/client/implementations/openai/__init__.py +0 -0
  29. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/client/implementations/openai/non_stream_openai_client.py +0 -0
  30. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/client/implementations/openai/non_stream_openai_responses_client.py +0 -0
  31. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/client/implementations/openai/openai_token_couter.py +0 -0
  32. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/client/implementations/openai/steam_openai_responses_client.py +0 -0
  33. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/client/implementations/openai/stream_openai_client.py +0 -0
  34. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/client/implementations/printing_status.py +0 -0
  35. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/client/model_client/__init__.py +0 -0
  36. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/client/model_client/claude_client.py +0 -0
  37. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/client/model_client/gemini_client.py +0 -0
  38. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/client/model_client/openai_client.py +0 -0
  39. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/logic/__init__.py +0 -0
  40. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/logic/chat_generate/__init__.py +0 -0
  41. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/logic/chat_generate/chat_message_converter.py +0 -0
  42. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/logic/chat_generate/media_processor.py +0 -0
  43. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/logic/chat_generate/model_client_factory/__init__.py +0 -0
  44. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/logic/chat_generate/model_client_factory/claude_client_factory.py +0 -0
  45. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/logic/chat_generate/model_client_factory/openai_client_factory.py +0 -0
  46. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/logic/chat_generate/model_message_converter/__init__.py +0 -0
  47. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/logic/chat_generate/model_message_converter/claude_message_converter.py +0 -0
  48. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/logic/chat_generate/model_message_converter/gemini_message_converter.py +0 -0
  49. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/logic/chat_generate/model_message_converter/openai_message_converter.py +0 -0
  50. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/logic/chat_generate/model_message_converter/openai_responses_message_converter.py +0 -0
  51. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/logic/file_fetch.py +0 -0
  52. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/logic/message_preprocess/__init__.py +0 -0
  53. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/logic/message_preprocess/code_file_extensions.py +0 -0
  54. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/logic/message_preprocess/document_processor.py +0 -0
  55. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/logic/message_preprocess/file_type_checker.py +0 -0
  56. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/logic/message_preprocess/message_preprocessor.py +0 -0
  57. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/logic/model_prices.py +0 -0
  58. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/resources/__init__.py +0 -0
  59. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/type/__init__.py +0 -0
  60. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/type/chat_response.py +0 -0
  61. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/type/message.py +0 -0
  62. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/type/model_message/__init__.py +0 -0
  63. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/type/model_message/claude_message.py +0 -0
  64. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/type/model_message/gemini_message.py +0 -0
  65. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/type/model_message/openai_message.py +0 -0
  66. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/type/model_message/openai_responses_message.py +0 -0
  67. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/llm_bridge/type/serializer.py +0 -0
  68. {llm_bridge-1.10.3 → llm_bridge-1.11.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: LLM-Bridge
3
- Version: 1.10.3
3
+ Version: 1.11.0
4
4
  Summary: A Bridge for LLMs
5
5
  Author-email: windsnow1025 <windsnow1025@gmail.com>
6
6
  License-Expression: MIT
@@ -15,7 +15,7 @@ Requires-Dist: httpx
15
15
  Requires-Dist: tenacity
16
16
  Requires-Dist: openai==1.106.1
17
17
  Requires-Dist: tiktoken==0.11.0
18
- Requires-Dist: google-genai==1.28.0
18
+ Requires-Dist: google-genai==1.46.0
19
19
  Requires-Dist: anthropic==0.66.0
20
20
  Requires-Dist: PyMuPDF
21
21
  Requires-Dist: docxlatex>=1.1.1
@@ -3,7 +3,7 @@ httpx
3
3
  tenacity
4
4
  openai==1.106.1
5
5
  tiktoken==0.11.0
6
- google-genai==1.28.0
6
+ google-genai==1.46.0
7
7
  anthropic==0.66.0
8
8
  PyMuPDF
9
9
  docxlatex>=1.1.1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: LLM-Bridge
3
- Version: 1.10.3
3
+ Version: 1.11.0
4
4
  Summary: A Bridge for LLMs
5
5
  Author-email: windsnow1025 <windsnow1025@gmail.com>
6
6
  License-Expression: MIT
@@ -15,7 +15,7 @@ Requires-Dist: httpx
15
15
  Requires-Dist: tenacity
16
16
  Requires-Dist: openai==1.106.1
17
17
  Requires-Dist: tiktoken==0.11.0
18
- Requires-Dist: google-genai==1.28.0
18
+ Requires-Dist: google-genai==1.46.0
19
19
  Requires-Dist: anthropic==0.66.0
20
20
  Requires-Dist: PyMuPDF
21
21
  Requires-Dist: docxlatex>=1.1.1
@@ -8,8 +8,13 @@ async def count_gemini_tokens(
8
8
  if usage_metadata is None:
9
9
  return 0, 0
10
10
  input_tokens = usage_metadata.prompt_token_count
11
+ if input_tokens is None: # For Vertex AI
12
+ input_tokens = 0
11
13
  output_tokens = usage_metadata.candidates_token_count
12
14
  if output_tokens is None:
13
- output_tokens = usage_metadata.total_token_count - usage_metadata.prompt_token_count
15
+ total_token_count = usage_metadata.total_token_count
16
+ if total_token_count is None: # For Vertex AI
17
+ total_token_count = 0
18
+ output_tokens = total_token_count - input_tokens
14
19
  return input_tokens, output_tokens
15
20
 
@@ -60,7 +60,8 @@ async def create_chat_client(
60
60
  model=model,
61
61
  temperature=temperature,
62
62
  stream=stream,
63
- api_key=api_keys["GEMINI_FREE_API_KEY"]
63
+ api_key=api_keys["GEMINI_FREE_API_KEY"],
64
+ vertexai=False,
64
65
  )
65
66
  elif api_type == 'Gemini-Paid':
66
67
  return await create_gemini_client(
@@ -68,7 +69,17 @@ async def create_chat_client(
68
69
  model=model,
69
70
  temperature=temperature,
70
71
  stream=stream,
71
- api_key=api_keys["GEMINI_PAID_API_KEY"]
72
+ api_key=api_keys["GEMINI_PAID_API_KEY"],
73
+ vertexai=False,
74
+ )
75
+ elif api_type == 'Gemini-Vertex':
76
+ return await create_gemini_client(
77
+ messages=messages,
78
+ model=model,
79
+ temperature=temperature,
80
+ stream=stream,
81
+ api_key=api_keys["GEMINI_VERTEX_API_KEY"],
82
+ vertexai=True,
72
83
  )
73
84
  elif api_type == 'Claude':
74
85
  return await create_claude_client(
@@ -1,6 +1,7 @@
1
1
  from google import genai
2
2
  from google.genai import types
3
3
  from google.genai._api_client import HttpOptions
4
+ from google.genai.types import Modality
4
5
 
5
6
  from llm_bridge.client.implementations.gemini.non_stream_gemini_client import NonStreamGeminiClient
6
7
  from llm_bridge.client.implementations.gemini.stream_gemini_client import StreamGeminiClient
@@ -15,19 +16,20 @@ async def create_gemini_client(
15
16
  temperature: float,
16
17
  stream: bool,
17
18
  api_key: str,
19
+ vertexai: bool,
18
20
  ):
19
21
  client = genai.Client(
22
+ vertexai=vertexai,
20
23
  api_key=api_key,
21
- http_options=HttpOptions(api_version='v1alpha') # Thinking
22
24
  )
23
25
 
24
26
  system_instruction = None
25
27
  tools = []
26
28
  thinking_config = None
27
- response_modalities = ['Text']
29
+ response_modalities = [Modality.TEXT]
28
30
 
29
31
  system_instruction = extract_system_messages(messages) or " "
30
- if "image" not in model:
32
+ if "image" not in model and not vertexai:
31
33
  tools.append(
32
34
  types.Tool(
33
35
  google_search=types.GoogleSearch()
@@ -43,10 +45,24 @@ async def create_gemini_client(
43
45
  code_execution=types.ToolCodeExecution()
44
46
  )
45
47
  )
48
+ if "image" not in model and vertexai:
49
+ tools.append(
50
+ types.Tool(
51
+ google_search=types.GoogleSearch()
52
+ )
53
+ )
54
+ tools.append(
55
+ types.Tool(
56
+ url_context=types.UrlContext()
57
+ )
58
+ )
46
59
  if "image" not in model:
47
- thinking_config = types.ThinkingConfig(include_thoughts=True)
60
+ thinking_config = types.ThinkingConfig(
61
+ include_thoughts=True,
62
+ thinking_budget=-1,
63
+ )
48
64
  if "image" in model:
49
- response_modalities = ['Text', 'Image']
65
+ response_modalities = [Modality.TEXT, Modality.IMAGE]
50
66
 
51
67
  config = types.GenerateContentConfig(
52
68
  system_instruction=system_instruction,
@@ -54,23 +70,23 @@ async def create_gemini_client(
54
70
  safety_settings=[
55
71
  types.SafetySetting(
56
72
  category=types.HarmCategory.HARM_CATEGORY_HATE_SPEECH,
57
- threshold=types.HarmBlockThreshold.BLOCK_NONE,
73
+ threshold=types.HarmBlockThreshold.OFF,
58
74
  ),
59
75
  types.SafetySetting(
60
76
  category=types.HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT,
61
- threshold=types.HarmBlockThreshold.BLOCK_NONE,
77
+ threshold=types.HarmBlockThreshold.OFF,
62
78
  ),
63
79
  types.SafetySetting(
64
80
  category=types.HarmCategory.HARM_CATEGORY_HARASSMENT,
65
- threshold=types.HarmBlockThreshold.BLOCK_NONE,
81
+ threshold=types.HarmBlockThreshold.OFF,
66
82
  ),
67
83
  types.SafetySetting(
68
84
  category=types.HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT,
69
- threshold=types.HarmBlockThreshold.BLOCK_NONE,
85
+ threshold=types.HarmBlockThreshold.OFF,
70
86
  ),
71
87
  types.SafetySetting(
72
88
  category=types.HarmCategory.HARM_CATEGORY_CIVIC_INTEGRITY,
73
- threshold=types.HarmBlockThreshold.BLOCK_NONE,
89
+ threshold=types.HarmBlockThreshold.OFF,
74
90
  ),
75
91
  ],
76
92
  tools=tools,
@@ -127,7 +127,25 @@
127
127
  },
128
128
  {
129
129
  "apiType": "Gemini-Paid",
130
- "model": "gemini-2.5-flash-image-preview",
130
+ "model": "gemini-2.5-flash-image",
131
+ "input": 1.0,
132
+ "output": 2.5
133
+ },
134
+ {
135
+ "apiType": "Gemini-Vertex",
136
+ "model": "gemini-2.5-flash",
137
+ "input": 1,
138
+ "output": 2.5
139
+ },
140
+ {
141
+ "apiType": "Gemini-Vertex",
142
+ "model": "gemini-2.5-pro",
143
+ "input": 2.5,
144
+ "output": 15
145
+ },
146
+ {
147
+ "apiType": "Gemini-Vertex",
148
+ "model": "gemini-2.5-flash-image",
131
149
  "input": 1.0,
132
150
  "output": 2.5
133
151
  },
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "LLM-Bridge"
7
- version = "1.10.3"
7
+ version = "1.11.0"
8
8
  authors = [
9
9
  {name = "windsnow1025", email = "windsnow1025@gmail.com"}
10
10
  ]
@@ -23,7 +23,7 @@ dependencies = [
23
23
  "tenacity",
24
24
  "openai==1.106.1",
25
25
  "tiktoken==0.11.0",
26
- "google-genai==1.28.0",
26
+ "google-genai==1.46.0",
27
27
  "anthropic==0.66.0",
28
28
  "PyMuPDF",
29
29
  "docxlatex>=1.1.1",
File without changes
File without changes
File without changes
File without changes