LLM-Bridge 1.11.4__py3-none-any.whl → 1.11.6__py3-none-any.whl

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.
@@ -7,7 +7,8 @@ import httpx
7
7
  import openai
8
8
  from fastapi import HTTPException
9
9
  from openai import APIStatusError
10
- from openai.types.responses import WebSearchToolParam, Response
10
+ from openai.types.responses import WebSearchToolParam, Response, ResponseOutputItem, ResponseOutputMessage, \
11
+ ResponseOutputText, ResponseReasoningItem
11
12
 
12
13
  from llm_bridge.client.implementations.openai.openai_token_couter import count_openai_responses_input_tokens, \
13
14
  count_openai_output_tokens
@@ -21,19 +22,22 @@ def process_openai_responses_non_stream_response(
21
22
  input_tokens: int,
22
23
  ) -> ChatResponse:
23
24
 
24
- output_list = response.output
25
+ output_list: list[ResponseOutputItem] = response.output
25
26
 
26
27
  text: str = ""
28
+ thought: str = ""
27
29
  files: list[File] = []
28
30
  citations: list[Citation] = []
29
31
 
30
32
  for output in output_list:
31
33
  if output.type == "message":
32
- for content in output.content:
34
+ output_message: ResponseOutputMessage = output
35
+ for content in output_message.content:
33
36
  if content.type == "output_text":
34
- text += content.text
37
+ output_text: ResponseOutputText = content
38
+ text += output_text.text
35
39
  # Citation is unavailable in OpenAI Responses API
36
- # if annotations := content.annotations:
40
+ # elif annotations := content.annotations:
37
41
  # for annotation in annotations:
38
42
  # citations.append(
39
43
  # Citation(
@@ -41,7 +45,11 @@ def process_openai_responses_non_stream_response(
41
45
  # url=annotation.url
42
46
  # )
43
47
  # )
44
- # Image Generation untestable due to organization verification requirement
48
+ elif output.type == "reasoning":
49
+ reasoning_item: ResponseReasoningItem = output
50
+ for summary_delta in reasoning_item.summary:
51
+ thought += summary_delta.text
52
+ # Image Generation to be tested
45
53
  # if output.type == "image_generation_call":
46
54
  # file = File(
47
55
  # name="generated_image.png",
@@ -54,6 +62,7 @@ def process_openai_responses_non_stream_response(
54
62
  output_tokens = count_openai_output_tokens(chat_response)
55
63
  return ChatResponse(
56
64
  text=text,
65
+ thought=thought,
57
66
  files=files,
58
67
  citations=citations,
59
68
  input_tokens=input_tokens,
@@ -7,7 +7,7 @@ import httpx
7
7
  import openai
8
8
  from fastapi import HTTPException
9
9
  from openai import APIStatusError, AsyncStream
10
- from openai.types.responses import ResponseStreamEvent
10
+ from openai.types.responses import ResponseStreamEvent, ResponseReasoningSummaryTextDeltaEvent, ResponseTextDeltaEvent
11
11
 
12
12
  from llm_bridge.client.implementations.openai.openai_token_couter import count_openai_responses_input_tokens, \
13
13
  count_openai_output_tokens
@@ -18,15 +18,20 @@ from llm_bridge.type.serializer import serialize
18
18
 
19
19
  def process_delta(event: ResponseStreamEvent) -> ChatResponse:
20
20
  text: str = ""
21
+ thought: str = ""
21
22
  files: list[File] = []
22
23
  citations: list[Citation] = []
23
24
 
24
25
  if event.type == "response.output_text.delta":
25
- text = event.delta
26
+ text_delta_event: ResponseTextDeltaEvent = event
27
+ text = text_delta_event.delta
28
+ elif event.type == "response.reasoning_summary_text.delta":
29
+ reasoning_summary_text_delta_event: ResponseReasoningSummaryTextDeltaEvent = event
30
+ thought = reasoning_summary_text_delta_event.delta
26
31
  # Citation is unavailable in OpenAI Responses API
27
- if event.type == "response.output_text.annotation.added":
32
+ elif event.type == "response.output_text.annotation.added":
28
33
  pass
29
- # Image Generation untestable due to organization verification requirement
34
+ # Image Generation to be tested
30
35
  # if event.type == "response.image_generation_call.partial_image":
31
36
  # file = File(
32
37
  # name="generated_image.png",
@@ -37,6 +42,7 @@ def process_delta(event: ResponseStreamEvent) -> ChatResponse:
37
42
 
38
43
  chat_response = ChatResponse(
39
44
  text=text,
45
+ thought=thought,
40
46
  files=files,
41
47
  citations=citations,
42
48
  )
@@ -53,6 +59,7 @@ async def generate_chunk(
53
59
  output_tokens = count_openai_output_tokens(chat_response)
54
60
  yield ChatResponse(
55
61
  text=chat_response.text,
62
+ thought=chat_response.thought,
56
63
  files=chat_response.files,
57
64
  citations=chat_response.citations,
58
65
  input_tokens=input_tokens,
@@ -77,7 +77,10 @@ async def create_openai_client(
77
77
  if re.match(r"^o\d", model) or (re.match(r"gpt-5.*", model) and model != "gpt-5-chat-latest"):
78
78
  temperature = 1
79
79
  if re.match(r"gpt-5.*", model) and model != "gpt-5-chat-latest":
80
- reasoning = Reasoning(effort="high")
80
+ reasoning = Reasoning(
81
+ effort="high",
82
+ summary="auto",
83
+ )
81
84
  tools.append(
82
85
  ImageGeneration(
83
86
  type="image_generation",
@@ -67,34 +67,16 @@
67
67
  },
68
68
  {
69
69
  "apiType": "OpenAI",
70
- "model": "gpt-5-chat-latest",
70
+ "model": "gpt-5.1",
71
71
  "input": 1.25,
72
72
  "output": 10
73
73
  },
74
- {
75
- "apiType": "OpenAI",
76
- "model": "gpt-4.1",
77
- "input": 2,
78
- "output": 8
79
- },
80
- {
81
- "apiType": "OpenAI",
82
- "model": "gpt-4.1-mini",
83
- "input": 0.4,
84
- "output": 1.6
85
- },
86
74
  {
87
75
  "apiType": "OpenAI",
88
76
  "model": "gpt-5",
89
77
  "input": 1.25,
90
78
  "output": 10
91
79
  },
92
- {
93
- "apiType": "OpenAI",
94
- "model": "gpt-5-pro",
95
- "input": 15,
96
- "output": 120
97
- },
98
80
  {
99
81
  "apiType": "OpenAI",
100
82
  "model": "gpt-5-mini",
@@ -103,39 +85,21 @@
103
85
  },
104
86
  {
105
87
  "apiType": "OpenAI",
106
- "model": "gpt-5-nano",
107
- "input": 0.05,
108
- "output": 0.4
109
- },
110
- {
111
- "apiType": "OpenAI",
112
- "model": "gpt-4o-audio-preview",
113
- "input": 5,
114
- "output": 15
115
- },
116
- {
117
- "apiType": "OpenAI",
118
- "model": "gpt-4o-mini",
119
- "input": 0.15,
120
- "output": 0.6
88
+ "model": "gpt-5-pro",
89
+ "input": 15,
90
+ "output": 120
121
91
  },
122
92
  {
123
93
  "apiType": "OpenAI",
124
- "model": "o3",
94
+ "model": "gpt-4.1",
125
95
  "input": 2,
126
96
  "output": 8
127
97
  },
128
98
  {
129
99
  "apiType": "OpenAI",
130
- "model": "o3-pro",
131
- "input": 20,
132
- "output": 80
133
- },
134
- {
135
- "apiType": "OpenAI",
136
- "model": "o4-mini",
137
- "input": 1.1,
138
- "output": 4.4
100
+ "model": "gpt-4o-audio-preview",
101
+ "input": 5,
102
+ "output": 15
139
103
  },
140
104
  {
141
105
  "apiType": "OpenAI-Azure",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: LLM-Bridge
3
- Version: 1.11.4
3
+ Version: 1.11.6
4
4
  Summary: A Bridge for LLMs
5
5
  Author-email: windsnow1025 <windsnow1025@gmail.com>
6
6
  License-Expression: MIT
@@ -15,9 +15,9 @@ llm_bridge/client/implementations/gemini/non_stream_gemini_client.py,sha256=JGNN
15
15
  llm_bridge/client/implementations/gemini/stream_gemini_client.py,sha256=vqPhQdr-jaHXzn-_1PSZfpo96zM-_89XOEXIx7UBBIw,1545
16
16
  llm_bridge/client/implementations/openai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  llm_bridge/client/implementations/openai/non_stream_openai_client.py,sha256=aceJm6FF6VdzVRECzJyTY8-aQjCekhhbrMPEcUN24fo,2171
18
- llm_bridge/client/implementations/openai/non_stream_openai_responses_client.py,sha256=mP4N6UuyWKrJPwh4GzzAZYzIaaSPWNeULFKpVCqgpt4,3756
18
+ llm_bridge/client/implementations/openai/non_stream_openai_responses_client.py,sha256=E8bBefhgtGM0qF3WH3VtXWbgls60kWVDWu2UG2SfsXM,4216
19
19
  llm_bridge/client/implementations/openai/openai_token_couter.py,sha256=twGl3-VvbvyrfgJBYJxL-g6OjvQvJMRp03mfOK_0bW0,1442
20
- llm_bridge/client/implementations/openai/steam_openai_responses_client.py,sha256=z7r35pUzMXuM1n9B5WjlKQCX-jtZL8jbiTe0t1P1Xco,3701
20
+ llm_bridge/client/implementations/openai/steam_openai_responses_client.py,sha256=HdaIYeJg9o5TjyqMlGUjfsPF2MDoxWF8tOqsqIbNTw8,4100
21
21
  llm_bridge/client/implementations/openai/stream_openai_client.py,sha256=Izq4xH9EuLjUCBJsuSr6U4Kj6FN5c7w_oHf9wmQatXE,2988
22
22
  llm_bridge/client/model_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
23
  llm_bridge/client/model_client/claude_client.py,sha256=cuYORseQY8HVt-COh2J0C_mhqPehDB3A4G4vrunoSFA,1352
@@ -33,7 +33,7 @@ llm_bridge/logic/chat_generate/media_processor.py,sha256=ZR8G24EHwZZr2T9iFDRmScD
33
33
  llm_bridge/logic/chat_generate/model_client_factory/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
34
  llm_bridge/logic/chat_generate/model_client_factory/claude_client_factory.py,sha256=unSrPGhQ4wO4xeMnXOGlCfd6BZE7NNYs6mYVcchXOvc,2800
35
35
  llm_bridge/logic/chat_generate/model_client_factory/gemini_client_factory.py,sha256=ms0v1TnVA_JJFKhOkbF_qHeRJEAZ3SH2QOYUi2w_FBI,3614
36
- llm_bridge/logic/chat_generate/model_client_factory/openai_client_factory.py,sha256=uSDkNcUKdyzfJBE_KPq9Uqpt_DpDulluGjUT-iq8li0,4363
36
+ llm_bridge/logic/chat_generate/model_client_factory/openai_client_factory.py,sha256=00qZm99kL3yLiN04FhWzyO-Gx7xXo3EqMldGRwLUc2E,4414
37
37
  llm_bridge/logic/chat_generate/model_message_converter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
38
  llm_bridge/logic/chat_generate/model_message_converter/claude_message_converter.py,sha256=SfDhQXR7L5nCPHS4MIjwgzK_wER7qOUCc8gh-K77kKY,2441
39
39
  llm_bridge/logic/chat_generate/model_message_converter/gemini_message_converter.py,sha256=UjhzRX7sBa3-Zv1flMJd8bc8uRWMMav4UdJFhE6nVq4,1527
@@ -45,7 +45,7 @@ llm_bridge/logic/message_preprocess/document_processor.py,sha256=IsVqoFgWNa9i8cR
45
45
  llm_bridge/logic/message_preprocess/file_type_checker.py,sha256=nkrVki1a2udCeVqUnfIVi7Wxx8OMKbBuHw3FOlm17uo,1603
46
46
  llm_bridge/logic/message_preprocess/message_preprocessor.py,sha256=ERws57Dsu-f5LpWKqJ_SEP7omNWXeGoJaocX91P6QDQ,1907
47
47
  llm_bridge/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
48
- llm_bridge/resources/model_prices.json,sha256=JFCzCLulZ6z9qKKMjMuvZPk_d8Z9rM1GF0szkvfypv0,3442
48
+ llm_bridge/resources/model_prices.json,sha256=eUqgHRK--8LyBetN_Aps5Ypkq71Kxvagarw0vza07lg,2866
49
49
  llm_bridge/type/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
50
  llm_bridge/type/chat_response.py,sha256=zEw-my_I0-7msmlTySdBGE2vWUIPILex0UrUPqTJiYY,754
51
51
  llm_bridge/type/message.py,sha256=NyWmSSrciFfvF81aBwAH8qFpo5IpRhh8QXMselbYen8,370
@@ -55,8 +55,8 @@ llm_bridge/type/model_message/claude_message.py,sha256=gYJUTbLUeifQMva3Axarc-VFe
55
55
  llm_bridge/type/model_message/gemini_message.py,sha256=mh8pf929g7_NkBzSOwnLXyrwSzTT4yt2FmyX7NZn0sM,4302
56
56
  llm_bridge/type/model_message/openai_message.py,sha256=xFaLY-cZoSwNd7E9BSWQjBNcRfCVH11X9s2yxXlctR0,453
57
57
  llm_bridge/type/model_message/openai_responses_message.py,sha256=be1q2euA0ybjj4NO6NxOGIRB9eJuXSb4ssUm_bM4Ocs,1529
58
- llm_bridge-1.11.4.dist-info/licenses/LICENSE,sha256=m6uon-6P_CaiqcBfApMfjG9YRtDxcr40Z52JcqUCEAE,1069
59
- llm_bridge-1.11.4.dist-info/METADATA,sha256=II8Hf2JeAGqC2jfKWnxlTDS_Q2czQggnn6TuXm9CyF4,7849
60
- llm_bridge-1.11.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
61
- llm_bridge-1.11.4.dist-info/top_level.txt,sha256=PtxyrgNX1lSa1Ab_qswg0sekSXejG5zrS6b_v3Po05g,11
62
- llm_bridge-1.11.4.dist-info/RECORD,,
58
+ llm_bridge-1.11.6.dist-info/licenses/LICENSE,sha256=m6uon-6P_CaiqcBfApMfjG9YRtDxcr40Z52JcqUCEAE,1069
59
+ llm_bridge-1.11.6.dist-info/METADATA,sha256=1b13yPjeh13pTjqDW2UoWduCDc4F3Tly1V_g9vPPyNg,7849
60
+ llm_bridge-1.11.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
61
+ llm_bridge-1.11.6.dist-info/top_level.txt,sha256=PtxyrgNX1lSa1Ab_qswg0sekSXejG5zrS6b_v3Po05g,11
62
+ llm_bridge-1.11.6.dist-info/RECORD,,