@@ -825,21 +825,97 @@ export class CustomResponseParams {
825825 * For example:
826826 * ```
827827 * # 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+ *
828851 * "response":{
829852 * "json_parser":{
830- * "text_embeddings":"$.result.embeddings [*].embedding"
853+ * "text_embeddings":"$.data [*].embedding[*] "
831854 * }
832855 * }
833856 *
834857 * # 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+ *
835887 * "response":{
836888 * "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"
839891 * }
840892 * }
841893 *
842894 * # 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+ *
843919 * "response":{
844920 * "json_parser":{
845921 * "reranked_index":"$.result.scores[*].index", // optional
@@ -849,9 +925,33 @@ export class CustomResponseParams {
849925 * }
850926 *
851927 * # 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+ *
852952 * "response":{
853953 * "json_parser":{
854- * "completion_result":"$.result.text "
954+ * "completion_result":"$.choices[*].message.content "
855955 * }
856956 * }
857957 */
0 commit comments