lm-deluge 0.0.61__py3-none-any.whl → 0.0.62__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 lm-deluge might be problematic. Click here for more details.

lm_deluge/prompt.py CHANGED
@@ -474,22 +474,28 @@ class Message:
474
474
 
475
475
  def with_file(
476
476
  self,
477
- data: bytes | str | Path | io.BytesIO,
477
+ data: bytes | str | Path | io.BytesIO | File,
478
478
  *,
479
479
  media_type: str | None = None,
480
480
  filename: str | None = None,
481
+ # remote: bool = False,
482
+ # provider: Literal["openai", "anthropic", "google"] | None = None,
481
483
  ) -> "Message":
482
484
  """
483
485
  Append a file block and return self for chaining.
484
486
  """
485
- file = File(data, media_type=media_type, filename=filename)
487
+ if not isinstance(data, File):
488
+ file = File(data, media_type=media_type, filename=filename)
489
+ else:
490
+ file = data
491
+
486
492
  self.parts.append(file)
487
493
  return self
488
494
 
489
495
  @deprecated("with_file")
490
496
  def add_file(
491
497
  self,
492
- data: bytes | str | Path | io.BytesIO,
498
+ data: bytes | str | Path | io.BytesIO | File,
493
499
  *,
494
500
  media_type: str | None = None,
495
501
  filename: str | None = None,
@@ -499,6 +505,30 @@ class Message:
499
505
  """
500
506
  return self.with_file(data, media_type=media_type, filename=filename)
501
507
 
508
+ async def with_remote_file(
509
+ self,
510
+ data: bytes | str | Path | io.BytesIO | File,
511
+ *,
512
+ media_type: str | None = None,
513
+ filename: str | None = None,
514
+ provider: Literal["openai", "anthropic", "google"] = "openai",
515
+ ):
516
+ if not isinstance(data, File):
517
+ file = File(data, media_type=media_type, filename=filename)
518
+ else:
519
+ file = data
520
+
521
+ if not file.is_remote:
522
+ file = await file.as_remote(provider=provider)
523
+ else:
524
+ if file.remote_provider != provider:
525
+ raise ValueError(
526
+ f"File is already remote with provider {file.remote_provider}, cannot change provider"
527
+ )
528
+
529
+ self.parts.append(file)
530
+ return self
531
+
502
532
  def with_tool_call(self, id: str, name: str, arguments: dict) -> "Message":
503
533
  """Append a tool call block and return self for chaining."""
504
534
  self.parts.append(ToolCall(id=id, name=name, arguments=arguments))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lm_deluge
3
- Version: 0.0.61
3
+ Version: 0.0.62
4
4
  Summary: Python utility for using LLM API models.
5
5
  Author-email: Benjamin Anderson <ben@trytaylor.ai>
6
6
  Requires-Python: >=3.10
@@ -8,7 +8,7 @@ lm_deluge/embed.py,sha256=CO-TOlC5kOTAM8lcnicoG4u4K664vCBwHF1vHa-nAGg,13382
8
8
  lm_deluge/errors.py,sha256=oHjt7YnxWbh-eXMScIzov4NvpJMo0-2r5J6Wh5DQ1tk,209
9
9
  lm_deluge/file.py,sha256=PTmlJQ-IaYcYUFun9V0bJ1NPVP84edJrR0hvCMWFylY,19697
10
10
  lm_deluge/image.py,sha256=5AMXmn2x47yXeYNfMSMAOWcnlrOxxOel-4L8QCJwU70,8928
11
- lm_deluge/prompt.py,sha256=1hGLOIwdyGFokKv0dPiVpke3OPHD6vK5qO6q9E8H89Y,62020
11
+ lm_deluge/prompt.py,sha256=RsKgvAbcG_-cHfgR9pyrl9tEIo7rIlVxlPpCgZbbj3E,63005
12
12
  lm_deluge/request_context.py,sha256=cBayMFWupWhde2OjRugW3JH-Gin-WFGc6DK2Mb4Prdc,2576
13
13
  lm_deluge/rerank.py,sha256=-NBAJdHz9OB-SWWJnHzkFmeVO4wR6lFV7Vw-SxG7aVo,11457
14
14
  lm_deluge/tool.py,sha256=eZpzgkSIlGD7KdZQwzLF-UdyRJpRnNNXpceGJrNhRrE,26421
@@ -65,8 +65,8 @@ lm_deluge/util/logprobs.py,sha256=UkBZakOxWluaLqHrjARu7xnJ0uCHVfLGHJdnYlEcutk,11
65
65
  lm_deluge/util/spatial.py,sha256=BsF_UKhE-x0xBirc-bV1xSKZRTUhsOBdGqsMKme20C8,4099
66
66
  lm_deluge/util/validation.py,sha256=hz5dDb3ebvZrZhnaWxOxbNSVMI6nmaOODBkk0htAUhs,1575
67
67
  lm_deluge/util/xml.py,sha256=Ft4zajoYBJR3HHCt2oHwGfymGLdvp_gegVmJ-Wqk4Ck,10547
68
- lm_deluge-0.0.61.dist-info/licenses/LICENSE,sha256=uNNXGXPCw2TC7CUs7SEBkA-Mz6QBQFWUUEWDMgEs1dU,1058
69
- lm_deluge-0.0.61.dist-info/METADATA,sha256=TKr3MSJYw8Hx4Qx5dmldB5UiS1fqeiwcZRIolb6W4ug,13443
70
- lm_deluge-0.0.61.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
71
- lm_deluge-0.0.61.dist-info/top_level.txt,sha256=hqU-TJX93yBwpgkDtYcXyLr3t7TLSCCZ_reytJjwBaE,10
72
- lm_deluge-0.0.61.dist-info/RECORD,,
68
+ lm_deluge-0.0.62.dist-info/licenses/LICENSE,sha256=uNNXGXPCw2TC7CUs7SEBkA-Mz6QBQFWUUEWDMgEs1dU,1058
69
+ lm_deluge-0.0.62.dist-info/METADATA,sha256=OxyZBmmED2qbq0Aizaj6Hatrzg57qs0amHHTManmBrI,13443
70
+ lm_deluge-0.0.62.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
71
+ lm_deluge-0.0.62.dist-info/top_level.txt,sha256=hqU-TJX93yBwpgkDtYcXyLr3t7TLSCCZ_reytJjwBaE,10
72
+ lm_deluge-0.0.62.dist-info/RECORD,,