llm-dialog-manager 0.4.5__py3-none-any.whl → 0.4.7__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_dialog_manager/__init__.py +1 -1
- llm_dialog_manager/agent.py +21 -11
- {llm_dialog_manager-0.4.5.dist-info → llm_dialog_manager-0.4.7.dist-info}/METADATA +3 -2
- llm_dialog_manager-0.4.7.dist-info/RECORD +9 -0
- {llm_dialog_manager-0.4.5.dist-info → llm_dialog_manager-0.4.7.dist-info}/WHEEL +1 -1
- llm_dialog_manager-0.4.5.dist-info/RECORD +0 -9
- {llm_dialog_manager-0.4.5.dist-info → llm_dialog_manager-0.4.7.dist-info/licenses}/LICENSE +0 -0
- {llm_dialog_manager-0.4.5.dist-info → llm_dialog_manager-0.4.7.dist-info}/top_level.txt +0 -0
llm_dialog_manager/__init__.py
CHANGED
llm_dialog_manager/agent.py
CHANGED
@@ -393,17 +393,27 @@ def completion(model: str, messages: List[Dict[str, Union[str, List[Union[str, I
|
|
393
393
|
else: # OpenAI models
|
394
394
|
if model.endswith("-openai"):
|
395
395
|
model = model[:-7] # Remove last 7 characters ("-openai")
|
396
|
-
|
397
|
-
#
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
396
|
+
|
397
|
+
# Initialize OpenAI client with only supported parameters
|
398
|
+
client_kwargs = {"api_key": api_key}
|
399
|
+
if base_url:
|
400
|
+
client_kwargs["base_url"] = base_url
|
401
|
+
client = openai.OpenAI(**client_kwargs)
|
402
|
+
|
403
|
+
# Create base parameters
|
404
|
+
params = {
|
405
|
+
"model": model,
|
406
|
+
"messages": formatted_messages,
|
407
|
+
}
|
408
|
+
|
409
|
+
# Add optional parameters
|
410
|
+
if json_format:
|
411
|
+
params["response_format"] = {"type": "json_object"}
|
412
|
+
if not ("o1" in model or "o3" in model):
|
413
|
+
params["max_tokens"] = max_tokens
|
414
|
+
params["temperature"] = temperature
|
415
|
+
|
416
|
+
response = client.chat.completions.create(**params)
|
407
417
|
return response.choices[0].message.content
|
408
418
|
|
409
419
|
# Release the API key after successful use
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: llm_dialog_manager
|
3
|
-
Version: 0.4.
|
3
|
+
Version: 0.4.7
|
4
4
|
Summary: A Python package for managing LLM chat conversation history
|
5
5
|
Author-email: xihajun <work@2333.fun>
|
6
6
|
License: MIT
|
@@ -44,6 +44,7 @@ Requires-Dist: pytest-asyncio>=0.21.1; extra == "all"
|
|
44
44
|
Requires-Dist: pytest-cov>=4.1.0; extra == "all"
|
45
45
|
Requires-Dist: black>=23.9.1; extra == "all"
|
46
46
|
Requires-Dist: isort>=5.12.0; extra == "all"
|
47
|
+
Dynamic: license-file
|
47
48
|
|
48
49
|
# LLM Dialog Manager
|
49
50
|
|
@@ -0,0 +1,9 @@
|
|
1
|
+
llm_dialog_manager/__init__.py,sha256=uWTAXzyON6m5vqj_MS8_Pe7hga5TZ2YDhkMh0Z-FDew,86
|
2
|
+
llm_dialog_manager/agent.py,sha256=LGoX6erGcn9eaM4wRGfs0N5zS8Lop_57nPKzzBWrtk8,27871
|
3
|
+
llm_dialog_manager/chat_history.py,sha256=DKKRnj_M6h-4JncnH6KekMTghX7vMgdN3J9uOwXKzMU,10347
|
4
|
+
llm_dialog_manager/key_manager.py,sha256=shvxmn4zUtQx_p-x1EFyOmnk-WlhigbpKtxTKve-zXk,4421
|
5
|
+
llm_dialog_manager-0.4.7.dist-info/licenses/LICENSE,sha256=vWGbYgGuWpWrXL8-xi6pNcX5UzD6pWoIAZmcetyfbus,1064
|
6
|
+
llm_dialog_manager-0.4.7.dist-info/METADATA,sha256=mRNR-f-rRqDR_IFoFJe2oNcTVE27Ah6AN8ENGQwfzVg,4216
|
7
|
+
llm_dialog_manager-0.4.7.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
|
8
|
+
llm_dialog_manager-0.4.7.dist-info/top_level.txt,sha256=u2EQEXW0NGAt0AAHT7jx1odXZ4rZfjcgbmJhvKFuMkI,19
|
9
|
+
llm_dialog_manager-0.4.7.dist-info/RECORD,,
|
@@ -1,9 +0,0 @@
|
|
1
|
-
llm_dialog_manager/__init__.py,sha256=Vai6V5cLO8X7dkHgnALzKyhtDYdPhkd9oD0HPjzdqZ8,86
|
2
|
-
llm_dialog_manager/agent.py,sha256=cYK3SMa1zPeSP4QoSxfceQ3YLQYqBTNwDE_ZJdBi7pM,27595
|
3
|
-
llm_dialog_manager/chat_history.py,sha256=DKKRnj_M6h-4JncnH6KekMTghX7vMgdN3J9uOwXKzMU,10347
|
4
|
-
llm_dialog_manager/key_manager.py,sha256=shvxmn4zUtQx_p-x1EFyOmnk-WlhigbpKtxTKve-zXk,4421
|
5
|
-
llm_dialog_manager-0.4.5.dist-info/LICENSE,sha256=vWGbYgGuWpWrXL8-xi6pNcX5UzD6pWoIAZmcetyfbus,1064
|
6
|
-
llm_dialog_manager-0.4.5.dist-info/METADATA,sha256=TbPdPjwrncfdYIJjFTzOoaWp5p90zYzpzsazVSK3F_8,4194
|
7
|
-
llm_dialog_manager-0.4.5.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
8
|
-
llm_dialog_manager-0.4.5.dist-info/top_level.txt,sha256=u2EQEXW0NGAt0AAHT7jx1odXZ4rZfjcgbmJhvKFuMkI,19
|
9
|
-
llm_dialog_manager-0.4.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|