@@ -825,21 +825,97 @@ export class CustomResponseParams {
825
825
* For example:
826
826
* ```
827
827
* # text_embedding
828
+ * # For a response like this:
829
+ *
830
+ * {
831
+ * "object": "list",
832
+ * "data": [
833
+ * {
834
+ * "object": "embedding",
835
+ * "index": 0,
836
+ * "embedding": [
837
+ * 0.014539449,
838
+ * -0.015288644
839
+ * ]
840
+ * }
841
+ * ],
842
+ * "model": "text-embedding-ada-002-v2",
843
+ * "usage": {
844
+ * "prompt_tokens": 8,
845
+ * "total_tokens": 8
846
+ * }
847
+ * }
848
+ *
849
+ * # the json_parser definition should look like this:
850
+ *
828
851
* "response":{
829
852
* "json_parser":{
830
- * "text_embeddings":"$.result.embeddings [*].embedding"
853
+ * "text_embeddings":"$.data [*].embedding[*] "
831
854
* }
832
855
* }
833
856
*
834
857
* # sparse_embedding
858
+ * # For a response like this:
859
+ *
860
+ * {
861
+ * "request_id": "75C50B5B-E79E-4930-****-F48DBB392231",
862
+ * "latency": 22,
863
+ * "usage": {
864
+ * "token_count": 11
865
+ * },
866
+ * "result": {
867
+ * "sparse_embeddings": [
868
+ * {
869
+ * "index": 0,
870
+ * "embedding": [
871
+ * {
872
+ * "token_id": 6,
873
+ * "weight": 0.101
874
+ * },
875
+ * {
876
+ * "token_id": 163040,
877
+ * "weight": 0.28417
878
+ * }
879
+ * ]
880
+ * }
881
+ * ]
882
+ * }
883
+ * }
884
+ *
885
+ * # the json_parser definition should look like this:
886
+ *
835
887
* "response":{
836
888
* "json_parser":{
837
- * "token_path":"$.result[*].embeddings [*].token ",
838
- * "weight_path":"$.result[*].embeddings [*].weight"
889
+ * "token_path":"$.result.sparse_embeddings [*].embedding [*].token_id ",
890
+ * "weight_path":"$.result.sparse_embeddings [*].embedding [*].weight"
839
891
* }
840
892
* }
841
893
*
842
894
* # rerank
895
+ * # For a response like this:
896
+ *
897
+ * {
898
+ * "results": [
899
+ * {
900
+ * "index": 3,
901
+ * "relevance_score": 0.999071,
902
+ * "document": "abc"
903
+ * },
904
+ * {
905
+ * "index": 4,
906
+ * "relevance_score": 0.7867867,
907
+ * "document": "123"
908
+ * },
909
+ * {
910
+ * "index": 0,
911
+ * "relevance_score": 0.32713068,
912
+ * "document": "super"
913
+ * }
914
+ * ],
915
+ * }
916
+ *
917
+ * # the json_parser definition should look like this:
918
+ *
843
919
* "response":{
844
920
* "json_parser":{
845
921
* "reranked_index":"$.result.scores[*].index", // optional
@@ -849,9 +925,33 @@ export class CustomResponseParams {
849
925
* }
850
926
*
851
927
* # completion
928
+ * # For a response like this:
929
+ *
930
+ * {
931
+ * "id": "chatcmpl-B9MBs8CjcvOU2jLn4n570S5qMJKcT",
932
+ * "object": "chat.completion",
933
+ * "created": 1741569952,
934
+ * "model": "gpt-4.1-2025-04-14",
935
+ * "choices": [
936
+ * {
937
+ * "index": 0,
938
+ * "message": {
939
+ * "role": "assistant",
940
+ * "content": "Hello! How can I assist you today?",
941
+ * "refusal": null,
942
+ * "annotations": []
943
+ * },
944
+ * "logprobs": null,
945
+ * "finish_reason": "stop"
946
+ * }
947
+ * ]
948
+ * }
949
+ *
950
+ * # the json_parser definition should look like this:
951
+ *
852
952
* "response":{
853
953
* "json_parser":{
854
- * "completion_result":"$.result.text "
954
+ * "completion_result":"$.choices[*].message.content "
855
955
* }
856
956
* }
857
957
*/
0 commit comments