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.
@@ -1,4 +1,4 @@
1
1
  from .chat_history import ChatHistory
2
2
  from .agent import Agent
3
3
 
4
- __version__ = "0.4.5"
4
+ __version__ = "0.4.7"
@@ -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
- client = openai.OpenAI(api_key=api_key, base_url=base_url)
397
- # Set response_format based on json_format
398
- response_format = {"type": "json_object"} if json_format else {"type": "plain_text"}
399
-
400
- response = client.chat.completions.create(
401
- model=model,
402
- messages=formatted_messages,
403
- max_tokens=max_tokens,
404
- temperature=temperature,
405
- response_format=response_format # Added response_format
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.2
1
+ Metadata-Version: 2.4
2
2
  Name: llm_dialog_manager
3
- Version: 0.4.5
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,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (77.0.3)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -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,,