lemonade-sdk 8.0.0__py3-none-any.whl → 8.0.1__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.

Potentially problematic release.


This version of lemonade-sdk might be problematic. Click here for more details.

@@ -416,25 +416,43 @@ def chat_completion(
416
416
  exclude_unset=True, exclude_none=True
417
417
  )
418
418
 
419
- def event_stream():
419
+ # Check if streaming is requested
420
+ if chat_completion_request.stream:
421
+
422
+ def event_stream():
423
+ try:
424
+ # Enable streaming
425
+ for chunk in client.chat.completions.create(**request_dict):
426
+ yield f"data: {chunk.model_dump_json()}\n\n"
427
+ yield "data: [DONE]\n\n"
428
+
429
+ # Show telemetry after completion
430
+ telemetry.show_telemetry()
431
+
432
+ except Exception as e: # pylint: disable=broad-exception-caught
433
+ yield f'data: {{"error": "{str(e)}"}}\n\n'
434
+
435
+ return StreamingResponse(
436
+ event_stream(),
437
+ media_type="text/event-stream",
438
+ headers={
439
+ "Cache-Control": "no-cache",
440
+ "Connection": "keep-alive",
441
+ },
442
+ )
443
+ else:
444
+ # Non-streaming response
420
445
  try:
421
- # Enable streaming
422
- request_dict["stream"] = True
423
- for chunk in client.chat.completions.create(**request_dict):
424
- yield f"data: {chunk.model_dump_json()}\n\n"
425
- yield "data: [DONE]\n\n"
446
+ # Disable streaming for non-streaming requests
447
+ response = client.chat.completions.create(**request_dict)
426
448
 
427
449
  # Show telemetry after completion
428
450
  telemetry.show_telemetry()
429
451
 
452
+ return response
453
+
430
454
  except Exception as e: # pylint: disable=broad-exception-caught
431
- yield f'data: {{"error": "{str(e)}"}}\n\n'
432
-
433
- return StreamingResponse(
434
- event_stream(),
435
- media_type="text/event-stream",
436
- headers={
437
- "Cache-Control": "no-cache",
438
- "Connection": "keep-alive",
439
- },
440
- )
455
+ raise HTTPException(
456
+ status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
457
+ detail=f"Chat completion error: {str(e)}",
458
+ )
@@ -29,6 +29,7 @@ from openai.types.chat.chat_completion_message_tool_call import (
29
29
  ChatCompletionMessageToolCall,
30
30
  Function,
31
31
  )
32
+ from openai.types.completion_usage import CompletionUsage
32
33
  from openai.types.chat.chat_completion import Choice
33
34
  from openai.types.chat.chat_completion_chunk import (
34
35
  ChoiceDelta,
@@ -576,9 +577,16 @@ class Server(ManagementTool):
576
577
  logprobs=logprobs,
577
578
  )
578
579
 
580
+ usage = CompletionUsage(
581
+ prompt_tokens=self.input_tokens,
582
+ completion_tokens=self.output_tokens,
583
+ total_tokens=self.input_tokens + self.output_tokens,
584
+ )
585
+
579
586
  return Completion(
580
587
  id="0",
581
588
  choices=[choice],
589
+ usage=usage,
582
590
  model=self.llm_loaded.checkpoint,
583
591
  object="text_completion",
584
592
  created=int(time.time()),
@@ -773,9 +781,16 @@ class Server(ManagementTool):
773
781
  logprobs=None,
774
782
  )
775
783
 
784
+ usage = CompletionUsage(
785
+ prompt_tokens=self.input_tokens,
786
+ completion_tokens=self.output_tokens,
787
+ total_tokens=self.input_tokens + self.output_tokens,
788
+ )
789
+
776
790
  return ChatCompletion(
777
791
  id="0",
778
792
  choices=[choice],
793
+ usage=usage,
779
794
  model=self.llm_loaded.checkpoint,
780
795
  object="chat.completion",
781
796
  created=int(time.time()),
lemonade/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "8.0.0"
1
+ __version__ = "8.0.1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lemonade-sdk
3
- Version: 8.0.0
3
+ Version: 8.0.1
4
4
  Summary: Lemonade SDK: Your LLM Aide for Validation and Deployment
5
5
  Author-email: lemonade@amd.com
6
6
  Requires-Python: >=3.10, <3.12
@@ -133,7 +133,7 @@ Maximum LLM performance requires the right hardware accelerator with the right i
133
133
  <tr>
134
134
  <td>🎮 GPU</td>
135
135
  <td align="center">—</td>
136
- <td align="center">Vulkan: All platforms<br><small>Focus: Radeon™ 7000/9000</small></td>
136
+ <td align="center">Vulkan: All platforms<br><small>Focus:<br/>Ryzen™ AI 7000/8000/300<br/>Radeon™ 7000/9000</small></td>
137
137
  <td align="center">—</td>
138
138
  <td align="center">✅</td>
139
139
  <td align="center">✅</td>
@@ -158,6 +158,10 @@ Maximum LLM performance requires the right hardware accelerator with the right i
158
158
  | **llamacpp** | Community-driven engine with strong GPU acceleration, support for thousands of `.gguf` models, and advanced features such as vision-language models (VLMs) and mixture-of-experts (MoEs). |
159
159
  | **Hugging Face (HF)** | Hugging Face's `transformers` library can run the original `.safetensors` trained weights for models on Meta's PyTorch engine, which provides a source of truth for accuracy measurement. |
160
160
 
161
+ ## Integrate Lemonade Server with Your Application
162
+
163
+ Lemonade Server enables languages including Python, C++, Java, C#, Node.js, Go, Ruby, Rust, and PHP. For the full list and integration details, see [docs/server/README.md](./docs/server/README.md).
164
+
161
165
  ## Contributing
162
166
 
163
167
  We are actively seeking collaborators from across the industry. If you would like to contribute to this project, please check out our [contribution guide](./docs/contribute.md).
@@ -4,7 +4,7 @@ lemonade/cache.py,sha256=djr2qgyUUAWlQv8FehU9qlNtCwK0IZqo82hcBDyZ3-A,2850
4
4
  lemonade/cli.py,sha256=XzptHh6LTl5OdGRnxiLykQ8QBl2rQmhWH5w0KPJVyY4,4359
5
5
  lemonade/sequence.py,sha256=KSH7BPsiyDKsOsg_ziQKEGsDwMmuO_YbgPRBxkZd0pw,13267
6
6
  lemonade/state.py,sha256=sdSezla7Cd7KYL90xY3p9kcNV4ndSyN6UvNLOr3vBMA,5261
7
- lemonade/version.py,sha256=SWqJTEDnx2fOon29wQowBCNjEkhyhMbbqVsSu4EpdWI,22
7
+ lemonade/version.py,sha256=qR-61NMOca8p2Rty8s6xwXQSXLDufw2os6i4zdyqfak,22
8
8
  lemonade/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  lemonade/common/build.py,sha256=zTb0m1-kuUx6zw5QHp2SNnVuN6jOTMQ2FCdj9iH374U,6140
10
10
  lemonade/common/cli_helpers.py,sha256=hjBfXrTtFl8gmCFlL-ksviXR0mOcdPtTWVNKoEp3PG4,4993
@@ -44,8 +44,8 @@ lemonade/tools/report/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
44
44
  lemonade/tools/report/llm_report.py,sha256=bVHhwCINA-Ok2EdSwAsLubsc83N3KWOVuwTguw7jDcE,6676
45
45
  lemonade/tools/report/table.py,sha256=di8IZkolt_kaZfWri6GQkhPE1zCELqcrBcG1x1fzWqg,24843
46
46
  lemonade/tools/server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
- lemonade/tools/server/llamacpp.py,sha256=U2eE9zfwE5sWUnS8A9oSf0Ak4v8dbjnX3fBb76g6uiE,14969
48
- lemonade/tools/server/serve.py,sha256=2Z3mbK-iVXAGA6jBDgJSwuWMbBRbmN_E0lMN2h-u6Wo,52230
47
+ lemonade/tools/server/llamacpp.py,sha256=aDVjjkU2Z2PN25Uuy-lk6ByKPR8kg5r2X-YsVSs4vi8,15624
48
+ lemonade/tools/server/serve.py,sha256=3_jBpi6THnnAmtKOxvPlOkIhSTTmrlZE3fr2Dpto-Q4,52794
49
49
  lemonade/tools/server/tool_calls.py,sha256=xrAlQwKG-nv2xLlf8f9CDSaUbyMn8ZtHkds9iZLG9K8,5230
50
50
  lemonade/tools/server/tray.py,sha256=SakwhZKPgo7VtWP4q10SaCcZdxKG95dnNsXdTu9Eei0,16030
51
51
  lemonade/tools/server/webapp.py,sha256=8Das5yXOaSBLZmSZ_eddJajQFxBhvl5D6GI_hHlGbE0,1040
@@ -57,14 +57,14 @@ lemonade/tools/server/utils/system_tray.py,sha256=b9lvNv9chJKQxvmH7qzAuUe6H9HsLu
57
57
  lemonade/tools/server/utils/thread.py,sha256=pK9K_6DNWoQ78NArkAX3Ym2WsxLnCs9sKTk6TitlYnI,2804
58
58
  lemonade_install/__init__.py,sha256=26zohKg2jgr_5y7tObduWMYQg8zCTWMZHL8lfi2zZVQ,40
59
59
  lemonade_install/install.py,sha256=DJWR36QSjZtvEwRjYPNSjhYgoxLjI_6OPrCMZjL0ChY,28263
60
- lemonade_sdk-8.0.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
61
- lemonade_sdk-8.0.0.dist-info/licenses/NOTICE.md,sha256=B8lEqi4QE41J9ljz4Riv2JgHD1v8GCZE6nNBHO3KIA0,2135
60
+ lemonade_sdk-8.0.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
61
+ lemonade_sdk-8.0.1.dist-info/licenses/NOTICE.md,sha256=B8lEqi4QE41J9ljz4Riv2JgHD1v8GCZE6nNBHO3KIA0,2135
62
62
  lemonade_server/cli.py,sha256=fm1eORLKElHfzqO5VVicDmn9EbmqIffi1bynqacJeyw,11744
63
63
  lemonade_server/model_manager.py,sha256=HqbahDMRv1x8jyQj4pa1rXanlPmcCykt8tlI6WfaxjE,13023
64
64
  lemonade_server/pydantic_models.py,sha256=2ALw47C1VWGe2nKWjlEAzP1ggKYsky4xlahUFxQJCMs,2298
65
65
  lemonade_server/server_models.json,sha256=wTK_H9XDHLxqMWQJqbBsJwm50PhOR4gURyVj9Jm35PQ,6992
66
- lemonade_sdk-8.0.0.dist-info/METADATA,sha256=fJV_bzC7VCQjqpHTDkb8G58fvBlbsuqOa_zEJNZW5JU,7940
67
- lemonade_sdk-8.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
68
- lemonade_sdk-8.0.0.dist-info/entry_points.txt,sha256=gJppn0ETtXXR6ceKWEIRdk42kMC7ps59EmU3NCPyPUk,144
69
- lemonade_sdk-8.0.0.dist-info/top_level.txt,sha256=10ap5GNiPhalO4V50LRoxA1FqRT9g3Xkia6BITu880k,42
70
- lemonade_sdk-8.0.0.dist-info/RECORD,,
66
+ lemonade_sdk-8.0.1.dist-info/METADATA,sha256=s5q-KKS3Drrxxm1-wGLUP9c0HymN2RgC7PjMqr0biog,8225
67
+ lemonade_sdk-8.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
68
+ lemonade_sdk-8.0.1.dist-info/entry_points.txt,sha256=gJppn0ETtXXR6ceKWEIRdk42kMC7ps59EmU3NCPyPUk,144
69
+ lemonade_sdk-8.0.1.dist-info/top_level.txt,sha256=10ap5GNiPhalO4V50LRoxA1FqRT9g3Xkia6BITu880k,42
70
+ lemonade_sdk-8.0.1.dist-info/RECORD,,