You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add an image url part to the multipart tool output
874
+
875
+
:param str image: The image url
876
+
"""
877
+
returnsuper().with_image_url(image)
878
+
790
879
791
880
classDSSLLMStreamedCompletionChunk(object):
881
+
"""
882
+
A handle to interact with a streamed completion query chunk.
883
+
884
+
.. important::
885
+
Do not create this class directly, iterate over a :class:`dataikuapi.dss.llm.DSSLLMStreamedCompletionChunks` iterator instead to generate the chunks instead.
886
+
"""
887
+
792
888
def__init__(self, data):
793
889
self.data=data
794
890
795
891
@property
796
892
deftype(self):
797
-
"""Type of this chunk, either "content" or "event" """
893
+
"""
894
+
:return: Type of this chunk, either "content" or "event"
895
+
:rtype: Literal["content", "event"]
896
+
"""
798
897
returnself.data.get("type", "content")
799
898
800
899
@property
801
900
deftext(self):
802
-
"""If this chunk is content and has text, the (partial) text"""
901
+
"""
902
+
:return: If this chunk is content and has text, the (partial) text
903
+
:rtype: bool
904
+
"""
803
905
returnself.data.get("text", None)
804
906
805
907
@property
806
908
defevent_kind(self):
807
-
"""If this chunk is an event, its kind"""
909
+
"""
910
+
:return: If this chunk is an event, its kind
911
+
:rtype: str
912
+
"""
808
913
returnself.data.get("eventKind", None)
809
914
810
915
def__repr__(self):
811
916
return"<completion-chunk: %s>"%self.data
812
917
813
918
814
919
classDSSLLMStreamedCompletionFooter(object):
920
+
"""
921
+
A handle to interact with a streamed completion query footer.
922
+
923
+
.. important::
924
+
Do not create this class directly, iterate over a :class:`dataikuapi.dss.llm.DSSLLMStreamedCompletionChunks` iterator instead to generate the chunks instead.
925
+
"""
926
+
815
927
def__init__(self, data):
816
928
self.data=data
817
929
818
930
# Compatibility for code that just checks for "type""
819
931
@property
820
932
deftype(self):
933
+
"""
934
+
:return: Type of this chunk, to distinguish it from :class:`dataikuapi.dss.llm.DSSLLMStreamedCompletionChunk` chunks. Can only be "footer"
935
+
:rtype: Literal["footer"]
936
+
"""
821
937
return"footer"
822
938
823
939
@property
824
940
deftrace(self):
941
+
"""
942
+
:return: The trace of the completion query if available, None otherwise.
943
+
:rtype: Union[dict, None]
944
+
"""
825
945
returnself.data.get("trace", None)
826
946
827
947
@property
@@ -890,7 +1010,11 @@ def iterevents(self):
890
1010
891
1011
classDSSLLMCompletionResponse(object):
892
1012
"""
893
-
Response to a completion
1013
+
A handle to interact with a completion query result.
1014
+
1015
+
.. important::
1016
+
Do not create this class directly, use :meth:`dataikuapi.dss.llm.DSSLLMCompletionQuery.execute` or
1017
+
:attr:`dataikuapi.dss.llm.DSSLLMCompletionsResponse.responses` or :attr:`dataikuapi.dss.llm.DSSLLMStreamedCompletionChunks.response` instead.
0 commit comments