LLM-Bridge 1.14.1__tar.gz → 1.15.0a0__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.
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/PKG-INFO +11 -11
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/README.md +10 -10
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/__init__.py +1 -1
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/implementations/gemini/gemini_response_handler.py +1 -15
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/implementations/openai/non_stream_openai_responses_client.py +9 -23
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/implementations/openai/steam_openai_responses_client.py +9 -17
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/type/chat_response.py +0 -15
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/pyproject.toml +1 -1
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/usage/main.py +8 -8
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/.gitattributes +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/.github/workflows/python-publish.yml +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/.gitignore +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/LICENSE +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/MANIFEST.in +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/__init__.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/chat_client.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/implementations/__init__.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/implementations/claude/__init__.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/implementations/claude/claude_response_handler.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/implementations/claude/claude_token_counter.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/implementations/claude/non_stream_claude_client.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/implementations/claude/stream_claude_client.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/implementations/gemini/__init__.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/implementations/gemini/gemini_token_counter.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/implementations/gemini/non_stream_gemini_client.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/implementations/gemini/stream_gemini_client.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/implementations/openai/__init__.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/implementations/openai/non_stream_openai_client.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/implementations/openai/openai_token_couter.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/implementations/openai/stream_openai_client.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/implementations/printing_status.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/model_client/__init__.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/model_client/claude_client.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/model_client/gemini_client.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/model_client/openai_client.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/logic/__init__.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/logic/chat_generate/__init__.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/logic/chat_generate/chat_client_factory.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/logic/chat_generate/chat_message_converter.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/logic/chat_generate/media_processor.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/logic/chat_generate/model_client_factory/__init__.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/logic/chat_generate/model_client_factory/claude_client_factory.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/logic/chat_generate/model_client_factory/gemini_client_factory.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/logic/chat_generate/model_client_factory/openai_client_factory.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/logic/chat_generate/model_client_factory/schema_converter.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/logic/chat_generate/model_message_converter/__init__.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/logic/chat_generate/model_message_converter/claude_message_converter.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/logic/chat_generate/model_message_converter/gemini_message_converter.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/logic/chat_generate/model_message_converter/openai_message_converter.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/logic/chat_generate/model_message_converter/openai_responses_message_converter.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/logic/file_fetch.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/logic/message_preprocess/__init__.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/logic/message_preprocess/code_file_extensions.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/logic/message_preprocess/document_processor.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/logic/message_preprocess/file_type_checker.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/logic/message_preprocess/message_preprocessor.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/logic/model_prices.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/resources/__init__.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/resources/model_prices.json +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/type/__init__.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/type/message.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/type/model_message/__init__.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/type/model_message/claude_message.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/type/model_message/gemini_message.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/type/model_message/openai_message.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/type/model_message/openai_responses_message.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/type/serializer.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/tests/__init__.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/tests/chat_client_factory_test.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/tests/message_preprocessor_test.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/usage/.env.example +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/usage/workflow.py +0 -0
- {llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: LLM-Bridge
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.15.0a0
|
|
4
4
|
Summary: A Bridge for LLMs
|
|
5
5
|
Author-email: windsnow1025 <windsnow1025@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -37,21 +37,21 @@ PyPI: [https://pypi.org/project/LLM-Bridge/](https://pypi.org/project/LLM-Bridge
|
|
|
37
37
|
1. **Model Message Converter**: converts general messages to model messages
|
|
38
38
|
1. **Media Processor**: converts general media (Image, Audio, Video, PDF) to model compatible formats.
|
|
39
39
|
3. **Chat Client**: generate stream or non-stream responses
|
|
40
|
-
- **Model Thoughts**: captures
|
|
41
|
-
- **Code Execution**:
|
|
42
|
-
- **Web Search
|
|
40
|
+
- **Model Thoughts**: captures the model's thinking process
|
|
41
|
+
- **Code Execution**: generates and executes Python code
|
|
42
|
+
- **Web Search**: generates response from search results
|
|
43
43
|
- **Token Counter**: tracks and reports input and output token usage
|
|
44
44
|
|
|
45
45
|
### Supported Features for API Types
|
|
46
46
|
|
|
47
47
|
The features listed represent the maximum capabilities of each API type supported by LLM Bridge.
|
|
48
48
|
|
|
49
|
-
| API Type | Input Format | Capabilities
|
|
50
|
-
|
|
51
|
-
| OpenAI | Text, Image, PDF | Thinking, Web Search, Code Execution
|
|
52
|
-
| Gemini | Text, Image, Video, Audio, PDF | Thinking, Web Search
|
|
53
|
-
| Claude | Text, Image, PDF | Thinking, Web Search, Code Execution
|
|
54
|
-
| Grok | Text, Image |
|
|
49
|
+
| API Type | Input Format | Capabilities | Output Format |
|
|
50
|
+
|----------|--------------------------------|---------------------------------------------------------|-------------------|
|
|
51
|
+
| OpenAI | Text, Image, PDF | Thinking, Web Search, Code Execution | Text |
|
|
52
|
+
| Gemini | Text, Image, Video, Audio, PDF | Thinking, Web Search, Code Execution, Structured Output | Text, Image, File |
|
|
53
|
+
| Claude | Text, Image, PDF | Thinking, Web Search, Code Execution | Text |
|
|
54
|
+
| Grok | Text, Image | | Text |
|
|
55
55
|
|
|
56
56
|
#### Planned Features
|
|
57
57
|
|
|
@@ -70,7 +70,7 @@ The features listed represent the maximum capabilities of each API type supporte
|
|
|
70
70
|
uv sync --refresh
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
-
### Pycharm
|
|
73
|
+
### Pycharm
|
|
74
74
|
|
|
75
75
|
1. Add New Interpreter >> Add Local Interpreter
|
|
76
76
|
- Environment: Select existing
|
|
@@ -13,21 +13,21 @@ PyPI: [https://pypi.org/project/LLM-Bridge/](https://pypi.org/project/LLM-Bridge
|
|
|
13
13
|
1. **Model Message Converter**: converts general messages to model messages
|
|
14
14
|
1. **Media Processor**: converts general media (Image, Audio, Video, PDF) to model compatible formats.
|
|
15
15
|
3. **Chat Client**: generate stream or non-stream responses
|
|
16
|
-
- **Model Thoughts**: captures
|
|
17
|
-
- **Code Execution**:
|
|
18
|
-
- **Web Search
|
|
16
|
+
- **Model Thoughts**: captures the model's thinking process
|
|
17
|
+
- **Code Execution**: generates and executes Python code
|
|
18
|
+
- **Web Search**: generates response from search results
|
|
19
19
|
- **Token Counter**: tracks and reports input and output token usage
|
|
20
20
|
|
|
21
21
|
### Supported Features for API Types
|
|
22
22
|
|
|
23
23
|
The features listed represent the maximum capabilities of each API type supported by LLM Bridge.
|
|
24
24
|
|
|
25
|
-
| API Type | Input Format | Capabilities
|
|
26
|
-
|
|
27
|
-
| OpenAI | Text, Image, PDF | Thinking, Web Search, Code Execution
|
|
28
|
-
| Gemini | Text, Image, Video, Audio, PDF | Thinking, Web Search
|
|
29
|
-
| Claude | Text, Image, PDF | Thinking, Web Search, Code Execution
|
|
30
|
-
| Grok | Text, Image |
|
|
25
|
+
| API Type | Input Format | Capabilities | Output Format |
|
|
26
|
+
|----------|--------------------------------|---------------------------------------------------------|-------------------|
|
|
27
|
+
| OpenAI | Text, Image, PDF | Thinking, Web Search, Code Execution | Text |
|
|
28
|
+
| Gemini | Text, Image, Video, Audio, PDF | Thinking, Web Search, Code Execution, Structured Output | Text, Image, File |
|
|
29
|
+
| Claude | Text, Image, PDF | Thinking, Web Search, Code Execution | Text |
|
|
30
|
+
| Grok | Text, Image | | Text |
|
|
31
31
|
|
|
32
32
|
#### Planned Features
|
|
33
33
|
|
|
@@ -46,7 +46,7 @@ The features listed represent the maximum capabilities of each API type supporte
|
|
|
46
46
|
uv sync --refresh
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
### Pycharm
|
|
49
|
+
### Pycharm
|
|
50
50
|
|
|
51
51
|
1. Add New Interpreter >> Add Local Interpreter
|
|
52
52
|
- Environment: Select existing
|
|
@@ -2,6 +2,6 @@ from .logic.chat_generate.chat_client_factory import create_chat_client
|
|
|
2
2
|
from .logic.chat_generate.chat_message_converter import *
|
|
3
3
|
from .logic.message_preprocess.message_preprocessor import preprocess_messages
|
|
4
4
|
from .logic.model_prices import ModelPrice, get_model_prices, find_model_prices, calculate_chat_cost
|
|
5
|
-
from .type.chat_response import
|
|
5
|
+
from .type.chat_response import ChatResponse
|
|
6
6
|
from .type.message import Role, Message, Content, ContentType
|
|
7
7
|
from .type.serializer import serialize
|
|
@@ -7,7 +7,7 @@ from google.genai.types import Part
|
|
|
7
7
|
|
|
8
8
|
from llm_bridge.client.implementations.gemini.gemini_token_counter import count_gemini_tokens
|
|
9
9
|
from llm_bridge.client.implementations.printing_status import PrintingStatus
|
|
10
|
-
from llm_bridge.type.chat_response import
|
|
10
|
+
from llm_bridge.type.chat_response import ChatResponse, File
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class GeminiResponseHandler:
|
|
@@ -26,7 +26,6 @@ class GeminiResponseHandler:
|
|
|
26
26
|
code_output: str = ""
|
|
27
27
|
files: list[File] = []
|
|
28
28
|
display: Optional[str] = None
|
|
29
|
-
citations: list[Citation] = extract_citations(response)
|
|
30
29
|
input_tokens, stage_output_tokens = await count_gemini_tokens(response)
|
|
31
30
|
|
|
32
31
|
parts: list[Part] = []
|
|
@@ -89,19 +88,6 @@ class GeminiResponseHandler:
|
|
|
89
88
|
code_output=code_output,
|
|
90
89
|
files=files,
|
|
91
90
|
display=display,
|
|
92
|
-
citations=citations,
|
|
93
91
|
input_tokens=input_tokens,
|
|
94
92
|
output_tokens=output_tokens,
|
|
95
93
|
)
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
def extract_citations(response: types.GenerateContentResponse) -> list[Citation]:
|
|
99
|
-
citations = []
|
|
100
|
-
if candidates := response.candidates:
|
|
101
|
-
if grounding_metadata := candidates[0].grounding_metadata:
|
|
102
|
-
if grounding_supports := grounding_metadata.grounding_supports:
|
|
103
|
-
for grounding_support in grounding_supports:
|
|
104
|
-
citation_indices = [index + 1 for index in grounding_support.grounding_chunk_indices]
|
|
105
|
-
citation_text = grounding_support.segment.text
|
|
106
|
-
citations.append(Citation(text=citation_text, indices=citation_indices))
|
|
107
|
-
return citations
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import re
|
|
3
|
-
from pprint import pprint
|
|
4
|
-
from typing import Optional
|
|
5
3
|
|
|
6
4
|
import httpx
|
|
7
5
|
import openai
|
|
8
6
|
from fastapi import HTTPException
|
|
9
7
|
from openai import APIStatusError
|
|
10
|
-
from openai.types.responses import
|
|
8
|
+
from openai.types.responses import Response, ResponseOutputItem, ResponseOutputMessage, \
|
|
11
9
|
ResponseOutputText, ResponseReasoningItem
|
|
12
10
|
|
|
13
11
|
from llm_bridge.client.implementations.openai.openai_token_couter import count_openai_responses_input_tokens, \
|
|
14
12
|
count_openai_output_tokens
|
|
15
13
|
from llm_bridge.client.model_client.openai_client import OpenAIClient
|
|
16
|
-
from llm_bridge.type.chat_response import ChatResponse,
|
|
14
|
+
from llm_bridge.type.chat_response import ChatResponse, File
|
|
17
15
|
from llm_bridge.type.serializer import serialize
|
|
18
16
|
|
|
19
17
|
|
|
@@ -27,7 +25,6 @@ def process_openai_responses_non_stream_response(
|
|
|
27
25
|
text: str = ""
|
|
28
26
|
thought: str = ""
|
|
29
27
|
files: list[File] = []
|
|
30
|
-
citations: list[Citation] = []
|
|
31
28
|
|
|
32
29
|
for output in output_list:
|
|
33
30
|
if output.type == "message":
|
|
@@ -36,27 +33,17 @@ def process_openai_responses_non_stream_response(
|
|
|
36
33
|
if content.type == "output_text":
|
|
37
34
|
output_text: ResponseOutputText = content
|
|
38
35
|
text += output_text.text
|
|
39
|
-
# Citation is unavailable in OpenAI Responses API
|
|
40
|
-
# elif annotations := content.annotations:
|
|
41
|
-
# for annotation in annotations:
|
|
42
|
-
# citations.append(
|
|
43
|
-
# Citation(
|
|
44
|
-
# text=content.text[annotation.start_index:annotation.end_index],
|
|
45
|
-
# url=annotation.url
|
|
46
|
-
# )
|
|
47
|
-
# )
|
|
48
36
|
elif output.type == "reasoning":
|
|
49
37
|
reasoning_item: ResponseReasoningItem = output
|
|
50
38
|
for summary_delta in reasoning_item.summary:
|
|
51
39
|
thought += summary_delta.text
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
# files.append(file)
|
|
40
|
+
if output.type == "image_generation_call":
|
|
41
|
+
file = File(
|
|
42
|
+
name="generated_image.png",
|
|
43
|
+
data=output.result,
|
|
44
|
+
type="image/png",
|
|
45
|
+
)
|
|
46
|
+
files.append(file)
|
|
60
47
|
|
|
61
48
|
chat_response = ChatResponse(text=text, files=files)
|
|
62
49
|
output_tokens = count_openai_output_tokens(chat_response)
|
|
@@ -64,7 +51,6 @@ def process_openai_responses_non_stream_response(
|
|
|
64
51
|
text=text,
|
|
65
52
|
thought=thought,
|
|
66
53
|
files=files,
|
|
67
|
-
citations=citations,
|
|
68
54
|
input_tokens=input_tokens,
|
|
69
55
|
output_tokens=output_tokens,
|
|
70
56
|
)
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import re
|
|
3
|
-
from
|
|
4
|
-
from typing import AsyncGenerator, Optional
|
|
3
|
+
from typing import AsyncGenerator
|
|
5
4
|
|
|
6
5
|
import httpx
|
|
7
6
|
import openai
|
|
@@ -12,7 +11,7 @@ from openai.types.responses import ResponseStreamEvent, ResponseReasoningSummary
|
|
|
12
11
|
from llm_bridge.client.implementations.openai.openai_token_couter import count_openai_responses_input_tokens, \
|
|
13
12
|
count_openai_output_tokens
|
|
14
13
|
from llm_bridge.client.model_client.openai_client import OpenAIClient
|
|
15
|
-
from llm_bridge.type.chat_response import ChatResponse,
|
|
14
|
+
from llm_bridge.type.chat_response import ChatResponse, File
|
|
16
15
|
from llm_bridge.type.serializer import serialize
|
|
17
16
|
|
|
18
17
|
|
|
@@ -20,7 +19,6 @@ def process_delta(event: ResponseStreamEvent) -> ChatResponse:
|
|
|
20
19
|
text: str = ""
|
|
21
20
|
thought: str = ""
|
|
22
21
|
files: list[File] = []
|
|
23
|
-
citations: list[Citation] = []
|
|
24
22
|
|
|
25
23
|
if event.type == "response.output_text.delta":
|
|
26
24
|
text_delta_event: ResponseTextDeltaEvent = event
|
|
@@ -28,23 +26,18 @@ def process_delta(event: ResponseStreamEvent) -> ChatResponse:
|
|
|
28
26
|
elif event.type == "response.reasoning_summary_text.delta":
|
|
29
27
|
reasoning_summary_text_delta_event: ResponseReasoningSummaryTextDeltaEvent = event
|
|
30
28
|
thought = reasoning_summary_text_delta_event.delta
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
# data=event.partial_image_b64,
|
|
39
|
-
# type="image/png",
|
|
40
|
-
# )
|
|
41
|
-
# files.append(file)
|
|
29
|
+
if event.type == "response.image_generation_call.partial_image":
|
|
30
|
+
file = File(
|
|
31
|
+
name="generated_image.png",
|
|
32
|
+
data=event.partial_image_b64,
|
|
33
|
+
type="image/png",
|
|
34
|
+
)
|
|
35
|
+
files.append(file)
|
|
42
36
|
|
|
43
37
|
chat_response = ChatResponse(
|
|
44
38
|
text=text,
|
|
45
39
|
thought=thought,
|
|
46
40
|
files=files,
|
|
47
|
-
citations=citations,
|
|
48
41
|
)
|
|
49
42
|
return chat_response
|
|
50
43
|
|
|
@@ -61,7 +54,6 @@ async def generate_chunk(
|
|
|
61
54
|
text=chat_response.text,
|
|
62
55
|
thought=chat_response.thought,
|
|
63
56
|
files=chat_response.files,
|
|
64
|
-
citations=chat_response.citations,
|
|
65
57
|
input_tokens=input_tokens,
|
|
66
58
|
output_tokens=output_tokens,
|
|
67
59
|
)
|
|
@@ -9,20 +9,6 @@ class File:
|
|
|
9
9
|
type: str
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
@dataclass
|
|
13
|
-
class Citation:
|
|
14
|
-
text: str
|
|
15
|
-
indices: list[int]
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
# TODO: adapt to different Citation formats
|
|
19
|
-
# @dataclass
|
|
20
|
-
# class Citation:
|
|
21
|
-
# text: str
|
|
22
|
-
# indices: Optional[list[int]] = None
|
|
23
|
-
# url: Optional[str] = None
|
|
24
|
-
|
|
25
|
-
|
|
26
12
|
@dataclass
|
|
27
13
|
class ChatResponse:
|
|
28
14
|
text: Optional[str] = None
|
|
@@ -31,7 +17,6 @@ class ChatResponse:
|
|
|
31
17
|
code_output: Optional[str] = None
|
|
32
18
|
files: Optional[list[File]] = None
|
|
33
19
|
display: Optional[str] = None
|
|
34
|
-
citations: Optional[list[Citation]] = None
|
|
35
20
|
error: Optional[str] = None
|
|
36
21
|
input_tokens: Optional[int] = 0
|
|
37
22
|
output_tokens: Optional[int] = 0
|
|
@@ -98,7 +98,7 @@ messages = [
|
|
|
98
98
|
# Content(type=ContentType.Text, data="Explain the concept of Occam's Razor and provide a simple, everyday example."),
|
|
99
99
|
|
|
100
100
|
# Web Search
|
|
101
|
-
|
|
101
|
+
Content(type=ContentType.Text, data="What's the weather in NYC today?"),
|
|
102
102
|
|
|
103
103
|
# Image Understanding
|
|
104
104
|
# Content(type=ContentType.File, data="https://www.gstatic.com/webp/gallery3/1.png"),
|
|
@@ -111,7 +111,7 @@ messages = [
|
|
|
111
111
|
# Content(type=ContentType.Text, data="What is in https://www.windsnow1025.com/"),
|
|
112
112
|
|
|
113
113
|
# Code Execution
|
|
114
|
-
Content(type=ContentType.Text, data="What is the sum of the first 50 prime numbers? Generate and run code for the calculation, and make sure you get all 50."),
|
|
114
|
+
# Content(type=ContentType.Text, data="What is the sum of the first 50 prime numbers? Generate and run code for the calculation, and make sure you get all 50."),
|
|
115
115
|
|
|
116
116
|
# File Output
|
|
117
117
|
# Content(type=ContentType.File, data="https://www.windsnow1025.com/minio/windsnow/uploads/1/1758384216123-script.py"),
|
|
@@ -139,23 +139,23 @@ messages = [
|
|
|
139
139
|
# model = "gpt-5-pro"
|
|
140
140
|
# model = "gpt-5"
|
|
141
141
|
# model = "gpt-4.1"
|
|
142
|
-
|
|
142
|
+
model = "gemini-3-pro-preview"
|
|
143
143
|
# model = "gemini-3-pro-image-preview"
|
|
144
|
-
model = "gemini-3-flash-preview"
|
|
144
|
+
# model = "gemini-3-flash-preview"
|
|
145
145
|
# model = "grok-4-1-fast-reasoning"
|
|
146
146
|
# model = "claude-sonnet-4-5"
|
|
147
147
|
# model = "claude-opus-4-5"
|
|
148
|
-
|
|
148
|
+
api_type = "Gemini-Vertex"
|
|
149
149
|
# api_type = "Gemini-Free"
|
|
150
|
-
api_type = "Gemini-Paid"
|
|
150
|
+
# api_type = "Gemini-Paid"
|
|
151
151
|
# api_type = "OpenAI"
|
|
152
152
|
# api_type = "OpenAI-Azure"
|
|
153
153
|
# api_type = "OpenAI-GitHub"
|
|
154
154
|
# api_type = "Claude"
|
|
155
155
|
# api_type = "Grok"
|
|
156
156
|
temperature = 0
|
|
157
|
-
stream = True
|
|
158
|
-
|
|
157
|
+
# stream = True
|
|
158
|
+
stream = False
|
|
159
159
|
thought = True
|
|
160
160
|
# thought = False
|
|
161
161
|
code_execution = True
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/implementations/claude/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/implementations/gemini/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/implementations/openai/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/client/implementations/printing_status.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/logic/chat_generate/chat_client_factory.py
RENAMED
|
File without changes
|
{llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/logic/chat_generate/chat_message_converter.py
RENAMED
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/logic/message_preprocess/document_processor.py
RENAMED
|
File without changes
|
{llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/logic/message_preprocess/file_type_checker.py
RENAMED
|
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
|
|
File without changes
|
|
File without changes
|
{llm_bridge-1.14.1 → llm_bridge-1.15.0a0}/llm_bridge/type/model_message/openai_responses_message.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|