LLM-Bridge 1.9.0a1__py3-none-any.whl → 1.10.0a0__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.
- llm_bridge/client/implementations/gemini/gemini_response_handler.py +4 -4
- llm_bridge/client/implementations/openai/non_stream_openai_responses_client.py +2 -2
- llm_bridge/client/implementations/openai/openai_token_couter.py +1 -1
- llm_bridge/client/implementations/openai/steam_openai_responses_client.py +2 -2
- llm_bridge/type/chat_response.py +1 -1
- {llm_bridge-1.9.0a1.dist-info → llm_bridge-1.10.0a0.dist-info}/METADATA +1 -1
- {llm_bridge-1.9.0a1.dist-info → llm_bridge-1.10.0a0.dist-info}/RECORD +10 -10
- {llm_bridge-1.9.0a1.dist-info → llm_bridge-1.10.0a0.dist-info}/WHEEL +0 -0
- {llm_bridge-1.9.0a1.dist-info → llm_bridge-1.10.0a0.dist-info}/licenses/LICENSE +0 -0
- {llm_bridge-1.9.0a1.dist-info → llm_bridge-1.10.0a0.dist-info}/top_level.txt +0 -0
|
@@ -22,7 +22,7 @@ class GeminiResponseHandler:
|
|
|
22
22
|
thought: str = ""
|
|
23
23
|
code: str = ""
|
|
24
24
|
code_output: str = ""
|
|
25
|
-
|
|
25
|
+
file: Optional[str] = None
|
|
26
26
|
display: Optional[str] = None
|
|
27
27
|
citations: list[Citation] = extract_citations(response)
|
|
28
28
|
input_tokens, stage_output_tokens = await count_gemini_tokens(response)
|
|
@@ -46,9 +46,9 @@ class GeminiResponseHandler:
|
|
|
46
46
|
# Code Output
|
|
47
47
|
if part.code_execution_result is not None:
|
|
48
48
|
code_output += part.code_execution_result.output
|
|
49
|
-
#
|
|
49
|
+
# File
|
|
50
50
|
if part.inline_data is not None:
|
|
51
|
-
|
|
51
|
+
file = base64.b64encode(part.inline_data.data).decode('utf-8')
|
|
52
52
|
|
|
53
53
|
# Grounding Sources
|
|
54
54
|
if candidates := response.candidates:
|
|
@@ -74,7 +74,7 @@ class GeminiResponseHandler:
|
|
|
74
74
|
thought=thought,
|
|
75
75
|
code=code,
|
|
76
76
|
code_output=code_output,
|
|
77
|
-
|
|
77
|
+
file=file,
|
|
78
78
|
display=display,
|
|
79
79
|
citations=citations,
|
|
80
80
|
input_tokens=input_tokens,
|
|
@@ -45,11 +45,11 @@ def process_openai_responses_non_stream_response(
|
|
|
45
45
|
# if output.type == "image_generation_call":
|
|
46
46
|
# image = output.result
|
|
47
47
|
|
|
48
|
-
chat_response = ChatResponse(text=text,
|
|
48
|
+
chat_response = ChatResponse(text=text, file=image)
|
|
49
49
|
output_tokens = count_openai_output_tokens(chat_response)
|
|
50
50
|
return ChatResponse(
|
|
51
51
|
text=text,
|
|
52
|
-
|
|
52
|
+
file=image,
|
|
53
53
|
citations=citations,
|
|
54
54
|
input_tokens=input_tokens,
|
|
55
55
|
output_tokens=output_tokens,
|
|
@@ -35,7 +35,7 @@ def count_openai_responses_input_tokens(messages: list[OpenAIResponsesMessage])
|
|
|
35
35
|
|
|
36
36
|
def count_openai_output_tokens(chat_response: ChatResponse) -> int:
|
|
37
37
|
text = chat_response.text
|
|
38
|
-
file_count = 1 if chat_response.
|
|
38
|
+
file_count = 1 if chat_response.file else 0
|
|
39
39
|
|
|
40
40
|
return num_tokens_from_text(text) + file_count * 1000
|
|
41
41
|
|
|
@@ -32,7 +32,7 @@ def process_delta(event: ResponseStreamEvent) -> ChatResponse:
|
|
|
32
32
|
|
|
33
33
|
chat_response = ChatResponse(
|
|
34
34
|
text=text,
|
|
35
|
-
|
|
35
|
+
file=image,
|
|
36
36
|
citations=citations,
|
|
37
37
|
)
|
|
38
38
|
return chat_response
|
|
@@ -48,7 +48,7 @@ async def generate_chunk(
|
|
|
48
48
|
output_tokens = count_openai_output_tokens(chat_response)
|
|
49
49
|
yield ChatResponse(
|
|
50
50
|
text=chat_response.text,
|
|
51
|
-
|
|
51
|
+
file=chat_response.file,
|
|
52
52
|
citations=chat_response.citations,
|
|
53
53
|
input_tokens=input_tokens,
|
|
54
54
|
output_tokens=output_tokens,
|
llm_bridge/type/chat_response.py
CHANGED
|
@@ -22,7 +22,7 @@ class ChatResponse:
|
|
|
22
22
|
thought: Optional[str] = None
|
|
23
23
|
code: Optional[str] = None
|
|
24
24
|
code_output: Optional[str] = None
|
|
25
|
-
|
|
25
|
+
file: Optional[str] = None
|
|
26
26
|
display: Optional[str] = None
|
|
27
27
|
citations: Optional[list[Citation]] = None
|
|
28
28
|
error: Optional[str] = None
|
|
@@ -9,15 +9,15 @@ llm_bridge/client/implementations/claude/claude_token_counter.py,sha256=g8M7BFY2
|
|
|
9
9
|
llm_bridge/client/implementations/claude/non_stream_claude_client.py,sha256=xnge1J-j_Er4K4L1UxhjuxAs_Pl6vralxTKk9yItwjI,2500
|
|
10
10
|
llm_bridge/client/implementations/claude/stream_claude_client.py,sha256=q4w1UYc1yZJw5UFOtnxCoeg8MFp5soc1d57YiCTCCGE,2109
|
|
11
11
|
llm_bridge/client/implementations/gemini/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
-
llm_bridge/client/implementations/gemini/gemini_response_handler.py,sha256=
|
|
12
|
+
llm_bridge/client/implementations/gemini/gemini_response_handler.py,sha256=qTidp_A1VJ_yPZ_T_QXBGeCmVNBQiDHUvJs4m4cueV8,4029
|
|
13
13
|
llm_bridge/client/implementations/gemini/gemini_token_counter.py,sha256=M_mlrtu_dZTgEG9JgRaPDVyXqFtHSSVAIhsknhOaVrs,504
|
|
14
14
|
llm_bridge/client/implementations/gemini/non_stream_gemini_client.py,sha256=JGNNpeln42SoXg2vGIC9xG5GGlBh6dIhz4BzYIkgraA,1302
|
|
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=
|
|
19
|
-
llm_bridge/client/implementations/openai/openai_token_couter.py,sha256=
|
|
20
|
-
llm_bridge/client/implementations/openai/steam_openai_responses_client.py,sha256=
|
|
18
|
+
llm_bridge/client/implementations/openai/non_stream_openai_responses_client.py,sha256=pL8B76hDl1QG6MAXW2DPdyN648vaqNuRzt8W2brXCAk,3593
|
|
19
|
+
llm_bridge/client/implementations/openai/openai_token_couter.py,sha256=CzYApUzUr4fsChKjZgXAjniTYbl_ZK-GjV95J7W3eVc,1448
|
|
20
|
+
llm_bridge/client/implementations/openai/steam_openai_responses_client.py,sha256=CZw7CAafTYxBORIxDVLFAmVnfBj_Fruz3jN2gL-f8us,3557
|
|
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
|
|
@@ -47,7 +47,7 @@ llm_bridge/logic/message_preprocess/message_preprocessor.py,sha256=ERws57Dsu-f5L
|
|
|
47
47
|
llm_bridge/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
48
48
|
llm_bridge/resources/model_prices.json,sha256=_2ZXKjnMDa6YSKfnWEPR_vUtuMw3cEi1d2L3IZ2kVxs,2707
|
|
49
49
|
llm_bridge/type/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
50
|
-
llm_bridge/type/chat_response.py,sha256=
|
|
50
|
+
llm_bridge/type/chat_response.py,sha256=1InuH0JlaAvATNB30m3htMrjoMKZ9mVSz8CLzHdLsag,679
|
|
51
51
|
llm_bridge/type/message.py,sha256=NyWmSSrciFfvF81aBwAH8qFpo5IpRhh8QXMselbYen8,370
|
|
52
52
|
llm_bridge/type/serializer.py,sha256=moCL9y_HTO2CFg2w_jc5MljDxKgHiCo_qiz-o4l2jYU,515
|
|
53
53
|
llm_bridge/type/model_message/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -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.
|
|
59
|
-
llm_bridge-1.
|
|
60
|
-
llm_bridge-1.
|
|
61
|
-
llm_bridge-1.
|
|
62
|
-
llm_bridge-1.
|
|
58
|
+
llm_bridge-1.10.0a0.dist-info/licenses/LICENSE,sha256=m6uon-6P_CaiqcBfApMfjG9YRtDxcr40Z52JcqUCEAE,1069
|
|
59
|
+
llm_bridge-1.10.0a0.dist-info/METADATA,sha256=24pi6zrIhlbpeC2Qy6EcaYh7vnP8JCMNj7iELS7zPM0,7851
|
|
60
|
+
llm_bridge-1.10.0a0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
61
|
+
llm_bridge-1.10.0a0.dist-info/top_level.txt,sha256=PtxyrgNX1lSa1Ab_qswg0sekSXejG5zrS6b_v3Po05g,11
|
|
62
|
+
llm_bridge-1.10.0a0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|