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
Copy file name to clipboardExpand all lines: meilisearch/client.py
+25-14Lines changed: 25 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -804,20 +804,31 @@ def create_chat_completion(
804
804
) ->Iterator[Dict[str, Any]]:
805
805
"""Streams a chat completion from the Meilisearch chat API.
806
806
807
-
Parameters:
808
-
workspace_uid: Unique identifier of the chat workspace to use.
809
-
messages: List of message dicts (e.g. {"role": "user", "content": "..."}) comprising the chat history.
810
-
model: The model name to use for completion (should correspond to the LLM in workspace settings).
811
-
stream: Whether to stream the response. Must be True for now (only streaming is supported).
807
+
Parameters
808
+
----------
809
+
workspace_uid:
810
+
Unique identifier of the chat workspace to use.
811
+
messages:
812
+
List of message dicts (e.g. {"role": "user", "content": "..."}) comprising the chat history.
813
+
model:
814
+
The model name to use for completion (should correspond to the LLM in workspace settings).
815
+
stream:
816
+
Whether to stream the response. Must be True for now (only streaming is supported).
812
817
813
-
Returns:
818
+
Returns
819
+
-------
820
+
chunks:
814
821
Parsed chunks of the completion as Python dicts. Each chunk is a partial response (in OpenAI format).
815
822
Iteration ends when the completion is done.
816
823
817
-
Raises:
818
-
MeilisearchApiError: If the API returns an error (e.g., invalid workspace or parameters).
819
-
MeilisearchCommunicationError: If a network error occurs.
820
-
ValueError: If stream=False is passed (not currently supported).
824
+
Raises
825
+
------
826
+
MeilisearchApiError
827
+
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors
828
+
MeilisearchCommunicationError
829
+
If a network error occurs.
830
+
ValueError
831
+
If stream=False is passed (not currently supported).
821
832
"""
822
833
ifnotstream:
823
834
# The API currently only supports streaming responses:
@@ -862,18 +873,18 @@ def get_chat_workspaces(
862
873
offset: Optional[int] =None,
863
874
limit: Optional[int] =None,
864
875
) ->Dict[str, Any]:
865
-
"""Return the list of chat workspaces (paginated).
876
+
"""Get all chat workspaces.
866
877
867
878
Parameters
868
879
----------
869
-
offset (optional): int
880
+
offset (optional):
870
881
Number of workspaces to skip.
871
-
limit (optional): int
882
+
limit (optional):
872
883
Maximum number of workspaces to return.
873
884
874
885
Returns
875
886
-------
876
-
dict:
887
+
workspaces:
877
888
Dictionary containing the list of chat workspaces and pagination information.
0 commit comments