Skip to content

ai

ai

AICRUDError

AICRUDError(
    operation: str,
    message: str | None = None,
    res=None,
    **kwargs,
)

Bases: RouteError

Raised when AI service create, update, or delete operations fail.

Source code in src/crew_dcs/routes/ai.py
77
78
79
80
81
82
83
84
85
86
87
88
def __init__(
    self,
    operation: str,
    message: str | None = None,
    res=None,
    **kwargs,
):
    super().__init__(
        message=message or f"AI service {operation} failed",
        res=res,
        **kwargs,
    )

AIGETError

AIGETError(message: str | None = None, res=None, **kwargs)

Bases: RouteError

Raised when AI service retrieval operations fail.

Source code in src/crew_dcs/routes/ai.py
66
67
68
69
70
71
def __init__(self, message: str | None = None, res=None, **kwargs):
    super().__init__(
        message=message or "AI service retrieval failed",
        res=res,
        **kwargs,
    )

ask_chat async

ask_chat(
    auth: DomoAuth,
    text_input: str,
    session_id: str | None = None,
    datasource_ids: list[str] | None = None,
    card_ids: list[str] | None = None,
    page_ids: list[str] | None = None,
    body: dict | None = None,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Endpoint

  • POST /ai/v1/assistant/toolkits/DOMO_BASIC_ASSISTANT/execute/streaming

Called by

Source code in src/crew_dcs/routes/ai.py
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def ask_chat(
    auth: DomoAuth,
    text_input: str,
    session_id: str | None = None,
    datasource_ids: list[str] | None = None,
    card_ids: list[str] | None = None,
    page_ids: list[str] | None = None,
    body: dict | None = None,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    url = f"https://{auth.domo_instance}.domo.com/api/ai/v1/assistant/toolkits/DOMO_BASIC_ASSISTANT/execute/streaming"
    request_body = body or {
        "input": text_input,
        "sessionId": session_id,
        "aiAssistantContext": {
            "dataSourceIds": datasource_ids or [],
            "cardIds": card_ids or [],
            "pageIds": page_ids or [],
            "filters": [],
            "ignorableDataSourceIds": [],
        },
        "agentType": "REACT",
    }
    res = await gd.get_data(
        auth=auth, url=url, method="POST", body=request_body, context=context
    )
    if return_raw:
        return res
    if not res.is_success:
        raise AICRUDError(operation="ask chat", res=res)
    return res

create_app_with_catalyst async

create_app_with_catalyst(
    auth: DomoAuth,
    text_input: str,
    session_id: str | None = None,
    datasource_ids: list[str] | None = None,
    card_ids: list[str] | None = None,
    page_ids: list[str] | None = None,
    body: dict | None = None,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Endpoint

  • POST /ai/v1/assistant/toolkits/APP_GENERATION_AGENT/execute/streaming

Called by

Source code in src/crew_dcs/routes/ai.py
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def create_app_with_catalyst(
    auth: DomoAuth,
    text_input: str,
    session_id: str | None = None,
    datasource_ids: list[str] | None = None,
    card_ids: list[str] | None = None,
    page_ids: list[str] | None = None,
    body: dict | None = None,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    url = f"https://{auth.domo_instance}.domo.com/api/ai/v1/assistant/toolkits/APP_GENERATION_AGENT/execute/streaming"
    request_body = body or {
        "input": text_input,
        "sessionId": session_id,
        "aiAssistantContext": {
            "dataSourceIds": datasource_ids or [],
            "cardIds": card_ids or [],
            "pageIds": page_ids or [],
            "filters": [],
            "ignorableDataSourceIds": [],
        },
        "agentType": "TOOL_CALLING",
    }
    res = await gd.get_data(
        auth=auth, url=url, method="POST", body=request_body, context=context
    )
    if return_raw:
        return res
    if not res.is_success:
        raise AICRUDError(operation="create app with catalyst", res=res)
    return res

create_dataset_ai_readiness async

create_dataset_ai_readiness(
    auth: DomoAuth,
    dataset_id: str,
    dictionary_name: str,
    description: str | None = None,
    columns: list[DataDictionary_ColumnsDict] | None = None,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Endpoint

  • POST /ai/readiness/v1/data-dictionary/dataset/{}

Called by

Source code in src/crew_dcs/routes/ai.py
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def create_dataset_ai_readiness(
    auth: DomoAuth,
    dataset_id: str,
    dictionary_name: str,
    description: str | None = None,
    columns: list[DataDictionary_ColumnsDict] | None = None,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    body = {
        "datasetId": dataset_id,
        "name": dictionary_name,
        "description": description,
        "unitOfAnalysis": "",
        "columns": columns or [],
    }

    url = f"https://{auth.domo_instance}.domo.com/api/ai/readiness/v1/data-dictionary/dataset/{dataset_id}"

    res = await gd.get_data(
        auth=auth,
        url=url,
        method="POST",
        body=body,
        context=context,
    )

    if return_raw:
        return res

    if not res.is_success:
        raise AICRUDError(operation="create", res=res, entity_id=dataset_id)

    return res

delete_ml_model async

delete_ml_model(
    auth: DomoAuth,
    model_id: str,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Endpoint

  • DELETE /datascience/ml/v1/models/{}

Called by

Source code in src/crew_dcs/routes/ai.py
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def delete_ml_model(
    auth: DomoAuth,
    model_id: str,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    url = (
        f"https://{auth.domo_instance}.domo.com/api/datascience/ml/v1/models/{model_id}"
    )
    res = await gd.get_data(auth=auth, url=url, method="DELETE", context=context)
    if return_raw:
        return res
    if not res.is_success:
        raise AICRUDError(operation="delete ml model", res=res, entity_id=model_id)
    return res

delete_ml_project async

delete_ml_project(
    auth: DomoAuth,
    project_id: str,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Endpoint

  • DELETE /datascience/ml/v1/projects/{}

Called by

Source code in src/crew_dcs/routes/ai.py
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def delete_ml_project(
    auth: DomoAuth,
    project_id: str,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    url = f"https://{auth.domo_instance}.domo.com/api/datascience/ml/v1/projects/{project_id}"
    res = await gd.get_data(auth=auth, url=url, method="DELETE", context=context)
    if return_raw:
        return res
    if not res.is_success:
        raise AICRUDError(operation="delete ml project", res=res, entity_id=project_id)
    return res

generate_chat_body

generate_chat_body(
    text_input: str,
    model: str = "domo.domo_ai.domogpt-chat-medium-v1.1:anthropic",
) -> dict

Build a /text/generation body.

WARNING: model availability is PER-INSTANCE. This default 404s on datacrew-space (DS-0043 "ML Model does not exist or access denied"); domo.domo_ai.domogpt-medium-v2.2:anthropic works there. Resolve the model at runtime — never ship a hardcoded default to another tenant.

Structured output: add responseFormat (spec: JsonResponseFormat in /openapi/product/AI-Services.yaml)::

body["responseFormat"] = {"type": "JSON", "schema": {...json schema...}}

type is UPPERCASE "JSON". Confirmed by elimination — json, json_schema, JSON_OBJECT, object all 400. Returns 200 with choices[0].output as a schema-conforming JSON string.

Source code in src/crew_dcs/routes/ai.py
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
def generate_chat_body(
    text_input: str, model: str = "domo.domo_ai.domogpt-chat-medium-v1.1:anthropic"
) -> dict:
    """Build a `/text/generation` body.

    WARNING: model availability is PER-INSTANCE. This default 404s on
    `datacrew-space` (`DS-0043 "ML Model does not exist or access denied"`);
    `domo.domo_ai.domogpt-medium-v2.2:anthropic` works there. Resolve the model
    at runtime — never ship a hardcoded default to another tenant.

    Structured output: add `responseFormat` (spec: `JsonResponseFormat` in
    `/openapi/product/AI-Services.yaml`)::

        body["responseFormat"] = {"type": "JSON", "schema": {...json schema...}}

    `type` is UPPERCASE `"JSON"`. Confirmed by elimination — `json`,
    `json_schema`, `JSON_OBJECT`, `object` all 400. Returns 200 with
    `choices[0].output` as a schema-conforming JSON string.
    """
    return {
        "input": text_input,
        "promptTemplate": {"template": "${input}"},
        "model": model,
    }

generate_image_to_text_body

generate_image_to_text_body(
    image_data: str,
    media_type: str = "image/png",
    text_input: str | None = None,
    system_prompt: str | None = None,
    model: str = "domo.domo_ai.domogpt-chat-medium-v1.1:anthropic",
) -> dict

Build the request body for the Image to Text AI service.

Source code in src/crew_dcs/routes/ai.py
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
def generate_image_to_text_body(
    image_data: str,
    media_type: str = "image/png",
    text_input: str | None = None,
    system_prompt: str | None = None,
    model: str = "domo.domo_ai.domogpt-chat-medium-v1.1:anthropic",
) -> dict:
    """Build the request body for the Image to Text AI service."""
    default_system = (
        "You are an AI assistant tasked with performing Optical Character Recognition "
        "(OCR) on an image. Your goal is to accurately identify and transcribe any text "
        "present in the image."
    )
    return {
        "input": text_input or "",
        "system": system_prompt or default_system,
        "promptTemplate": {"template": "${input}"},
        "model": model,
        "image": {
            "mediaType": media_type,
            "type": "base64",
            "data": image_data,
        },
    }

get_ai_session async

get_ai_session(
    auth: DomoAuth,
    session_id: str,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Endpoint

  • GET /ai/v1/sessions/{}

Called by

Source code in src/crew_dcs/routes/ai.py
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def get_ai_session(
    auth: DomoAuth,
    session_id: str,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    url = f"https://{auth.domo_instance}.domo.com/api/ai/v1/sessions/{session_id}"
    res = await gd.get_data(auth=auth, url=url, method="GET", context=context)
    if return_raw:
        return res
    if not res.is_success:
        raise AIGETError(res=res, entity_id=session_id)
    return res

get_ai_session_context async

get_ai_session_context(
    auth: DomoAuth,
    session_id: str,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Endpoint

  • GET /ai/v1/sessions/{}/context

Called by

Source code in src/crew_dcs/routes/ai.py
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def get_ai_session_context(
    auth: DomoAuth,
    session_id: str,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    url = (
        f"https://{auth.domo_instance}.domo.com/api/ai/v1/sessions/{session_id}/context"
    )
    res = await gd.get_data(auth=auth, url=url, method="GET", context=context)
    if return_raw:
        return res
    if not res.is_success:
        raise AIGETError(res=res, entity_id=session_id)
    return res

get_ai_settings async

get_ai_settings(
    auth: DomoAuth,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Endpoint

  • GET /ai/v1/settings/general

Called by

Source code in src/crew_dcs/routes/ai.py
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def get_ai_settings(
    auth: DomoAuth,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    url = f"https://{auth.domo_instance}.domo.com/api/ai/v1/settings/general"
    res = await gd.get_data(auth=auth, url=url, method="GET", context=context)
    if return_raw:
        return res
    if not res.is_success:
        raise AIGETError(res=res)
    return res

get_dataset_ai_readiness async

get_dataset_ai_readiness(
    auth: DomoAuth,
    dataset_id: str,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Endpoint

  • GET /ai/readiness/v1/data-dictionary/dataset/{}

Called by

Source code in src/crew_dcs/routes/ai.py
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def get_dataset_ai_readiness(
    auth: DomoAuth,
    dataset_id: str,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    url = f"https://{auth.domo_instance}.domo.com/api/ai/readiness/v1/data-dictionary/dataset/{dataset_id}"

    res = await gd.get_data(
        auth=auth,
        url=url,
        method="GET",
        context=context,
    )

    if return_raw:
        return res

    if not res.is_success:
        raise AIGETError(res=res, entity_id=dataset_id)

    return res

get_forecasting_default_model async

get_forecasting_default_model(
    auth: DomoAuth,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Endpoint

  • GET /ai/v1/settings/services/forecasting/models/default

Called by

Source code in src/crew_dcs/routes/ai.py
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def get_forecasting_default_model(
    auth: DomoAuth,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    url = f"https://{auth.domo_instance}.domo.com/api/ai/v1/settings/services/forecasting/models/default"
    res = await gd.get_data(auth=auth, url=url, method="GET", context=context)
    if return_raw:
        return res
    if not res.is_success:
        raise AIGETError(res=res)
    return res

get_forecasting_models async

get_forecasting_models(
    auth: DomoAuth,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Endpoint

  • GET /ai/v1/settings/services/forecasting/models

Called by

Source code in src/crew_dcs/routes/ai.py
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def get_forecasting_models(
    auth: DomoAuth,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    url = f"https://{auth.domo_instance}.domo.com/api/ai/v1/settings/services/forecasting/models"
    res = await gd.get_data(auth=auth, url=url, method="GET", context=context)
    if return_raw:
        return res
    if not res.is_success:
        raise AIGETError(res=res)
    return res

get_image_default_model async

get_image_default_model(
    auth: DomoAuth,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Endpoint

  • GET /ai/v1/settings/services/image/models/default

Called by

Source code in src/crew_dcs/routes/ai.py
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def get_image_default_model(
    auth: DomoAuth,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    url = f"https://{auth.domo_instance}.domo.com/api/ai/v1/settings/services/image/models/default"
    res = await gd.get_data(auth=auth, url=url, method="GET", context=context)
    if return_raw:
        return res
    if not res.is_success:
        raise AIGETError(res=res)
    return res

get_image_models async

get_image_models(
    auth: DomoAuth,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Endpoint

  • GET /ai/v1/settings/services/image/models

Called by

Source code in src/crew_dcs/routes/ai.py
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def get_image_models(
    auth: DomoAuth,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    url = f"https://{auth.domo_instance}.domo.com/api/ai/v1/settings/services/image/models"
    res = await gd.get_data(auth=auth, url=url, method="GET", context=context)
    if return_raw:
        return res
    if not res.is_success:
        raise AIGETError(res=res)
    return res

get_ml_model_by_id async

get_ml_model_by_id(
    auth: DomoAuth,
    model_id: str,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Endpoint

  • GET /datascience/ml/v1/models/{}

Called by

Source code in src/crew_dcs/routes/ai.py
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def get_ml_model_by_id(
    auth: DomoAuth,
    model_id: str,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    url = (
        f"https://{auth.domo_instance}.domo.com/api/datascience/ml/v1/models/{model_id}"
    )
    res = await gd.get_data(auth=auth, url=url, method="GET", context=context)
    if return_raw:
        return res
    if not res.is_success:
        raise AIGETError(res=res, entity_id=model_id)
    return res

get_ml_project_by_id async

get_ml_project_by_id(
    auth: DomoAuth,
    project_id: str,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Endpoint

  • GET /datascience/ml/v1/projects/{}

Called by

Source code in src/crew_dcs/routes/ai.py
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def get_ml_project_by_id(
    auth: DomoAuth,
    project_id: str,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    url = f"https://{auth.domo_instance}.domo.com/api/datascience/ml/v1/projects/{project_id}"
    res = await gd.get_data(auth=auth, url=url, method="GET", context=context)
    if return_raw:
        return res
    if not res.is_success:
        raise AIGETError(res=res, entity_id=project_id)
    return res

llm_generate_text async

llm_generate_text(
    text_input: str,
    auth: DomoAuth,
    chat_body: dict | None = None,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

POST /api/ai/v1/text/generation.

Pass chat_body to override the default (see generate_chat_body for the per-instance model trap and the responseFormat structured-output shape).

Debug tip — the status code tells you which half is wrong: 400 = field name recognised, value rejected 404 = field name unrecognised, fell through to model lookup (DS-0043)

Endpoint

  • POST /ai/v1/text/generation

Called by

Source code in src/crew_dcs/routes/ai.py
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def llm_generate_text(
    text_input: str,
    auth: DomoAuth,
    chat_body: dict | None = None,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """POST /api/ai/v1/text/generation.

    Pass `chat_body` to override the default (see `generate_chat_body` for the
    per-instance model trap and the `responseFormat` structured-output shape).

    Debug tip — the status code tells you which half is wrong:
      400 = field name recognised, value rejected
      404 = field name unrecognised, fell through to model lookup (`DS-0043`)
    """
    url = f"https://{auth.domo_instance}.domo.com/api/ai/v1/text/generation"

    body = chat_body or generate_chat_body(text_input=text_input)

    res = await gd.get_data(
        auth=auth,
        url=url,
        method="POST",
        body=body,
        context=context,
    )

    if return_raw:
        return res

    if not res.is_success:
        raise AICRUDError(operation="generate text", res=res)

    res.response["output"] = res.response["choices"][0]["output"]

    return res

llm_summarize_text async

llm_summarize_text(
    text_input: str,
    auth: DomoAuth,
    system_prompt: str | None = None,
    summary_length: int = 100,
    output_style: OutputStyleEnum = BULLETED,
    summary_body: dict | None = None,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Endpoint

  • POST /ai/v1/text/summarize
Source code in src/crew_dcs/routes/ai.py
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def llm_summarize_text(
    text_input: str,
    auth: DomoAuth,
    system_prompt: str | None = None,
    summary_length: int = 100,
    output_style: OutputStyleEnum = OutputStyleEnum.BULLETED,
    summary_body: dict | None = None,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    output_style = dmue.normalize_enum(output_style)

    url = f"https://{auth.domo_instance}.domo.com/api/ai/v1/text/summarize"

    body = summary_body or generate_summarize_body(
        text_input=text_input,
        system_prompt=system_prompt,
        output_style=output_style,
        summary_length=summary_length,
    )

    res = await gd.get_data(
        auth=auth,
        url=url,
        method="POST",
        body=body,
        context=context,
    )

    if return_raw:
        return res

    if not res.is_success:
        raise AICRUDError(operation="summarize text", res=res)

    res.response["ouptput"] = res.response["choices"][0]["output"]

    return res

run_image_to_text async

run_image_to_text(
    auth: DomoAuth,
    image_data: str,
    media_type: str = "image/png",
    text_input: str | None = None,
    system_prompt: str | None = None,
    model: str = "domo.domo_ai.domogpt-chat-medium-v1.1:anthropic",
    body: dict | None = None,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Run the Domo AI Image to Text (OCR) model.

Parameters:

Name Type Description Default
auth DomoAuth

Domo authentication credentials.

required
image_data str

Base64-encoded image content.

required
media_type str

MIME type of the image (e.g. "image/png").

'image/png'
text_input str | None

Optional additional instructions to pass as input.

None
system_prompt str | None

Override the default OCR system prompt.

None
model str

Domo AI model identifier.

'domo.domo_ai.domogpt-chat-medium-v1.1:anthropic'
body dict | None

Override the entire request body (all other args ignored).

None
return_raw bool

Return raw ResponseGetData without extracting text.

False

Endpoint

  • POST /ai/v1/image/text

Called by

Source code in src/crew_dcs/routes/ai.py
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def run_image_to_text(
    auth: DomoAuth,
    image_data: str,
    media_type: str = "image/png",
    text_input: str | None = None,
    system_prompt: str | None = None,
    model: str = "domo.domo_ai.domogpt-chat-medium-v1.1:anthropic",
    body: dict | None = None,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """Run the Domo AI Image to Text (OCR) model.

    Args:
        auth: Domo authentication credentials.
        image_data: Base64-encoded image content.
        media_type: MIME type of the image (e.g. ``"image/png"``).
        text_input: Optional additional instructions to pass as input.
        system_prompt: Override the default OCR system prompt.
        model: Domo AI model identifier.
        body: Override the entire request body (all other args ignored).
        return_raw: Return raw ``ResponseGetData`` without extracting text.
    """
    url = f"https://{auth.domo_instance}.domo.com/api/ai/v1/image/text"

    request_body = body or generate_image_to_text_body(
        image_data=image_data,
        media_type=media_type,
        text_input=text_input,
        system_prompt=system_prompt,
        model=model,
    )

    res = await gd.get_data(
        auth=auth,
        url=url,
        method="POST",
        body=request_body,
        context=context,
    )

    if return_raw:
        return res

    if not res.is_success:
        raise AICRUDError(operation="image to text", res=res)

    res.response["output"] = res.response["choices"][0]["output"]

    return res

search_ml_models async

search_ml_models(
    auth: DomoAuth,
    body: dict | None = None,
    limit: int = 50,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Endpoint

  • POST /datascience/ml/v1/search/models

Called by

Source code in src/crew_dcs/routes/ai.py
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def search_ml_models(
    auth: DomoAuth,
    body: dict | None = None,
    limit: int = 50,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    url = f"https://{auth.domo_instance}.domo.com/api/datascience/ml/v1/search/models"
    request_body = body or {
        "limit": limit,
        "sortFieldMap": {"CREATED": "DESC"},
        "searchFieldMap": {"NAME": ""},
        "filters": [],
        "metricFilters": {},
        "dateFilters": {},
        "sortMetricMap": {},
    }
    res = await gd.get_data(
        auth=auth, url=url, method="POST", body=request_body, context=context
    )
    if return_raw:
        return res
    if not res.is_success:
        raise AIGETError(res=res)
    return res

search_ml_projects async

search_ml_projects(
    auth: DomoAuth,
    body: dict | None = None,
    limit: int = 50,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Endpoint

  • POST /datascience/ml/v1/search/projects

Called by

Source code in src/crew_dcs/routes/ai.py
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def search_ml_projects(
    auth: DomoAuth,
    body: dict | None = None,
    limit: int = 50,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    url = f"https://{auth.domo_instance}.domo.com/api/datascience/ml/v1/search/projects"
    request_body = body or {
        "limit": limit,
        "sortFieldMap": {"CREATED": "DESC"},
        "searchFieldMap": {"NAME": ""},
        "filters": [],
        "dateFilters": {},
    }
    res = await gd.get_data(
        auth=auth, url=url, method="POST", body=request_body, context=context
    )
    if return_raw:
        return res
    if not res.is_success:
        raise AIGETError(res=res)
    return res

update_dataset_ai_readiness async

update_dataset_ai_readiness(
    auth: DomoAuth,
    dataset_id: str,
    dictionary_id: str | None = None,
    dictionary_name: str | None = None,
    columns: list[ColumnsDict] | None = None,
    description: str | None = None,
    body: dict | None = None,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Endpoint

  • PUT /ai/readiness/v1/data-dictionary/dataset/{}

Called by

Source code in src/crew_dcs/routes/ai.py
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def update_dataset_ai_readiness(
    auth: DomoAuth,
    dataset_id: str,
    dictionary_id: str | None = None,
    dictionary_name: str | None = None,
    columns: list[ColumnsDict] | None = None,
    description: str | None = None,
    body: dict | None = None,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    body = body or {
        "id": dictionary_id,
        "name": dictionary_name,
        "description": description,
        "columns": columns,
    }

    body.update({"datasetId": dataset_id})

    url = f"https://{auth.domo_instance}.domo.com/api/ai/readiness/v1/data-dictionary/dataset/{dataset_id}"

    res = await gd.get_data(
        auth=auth,
        url=url,
        method="PUT",
        body=body,
        context=context,
    )

    if return_raw:
        return res

    if not res.is_success:
        raise AICRUDError(operation="update", res=res, entity_id=dataset_id)

    return res

update_ml_model async

update_ml_model(
    auth: DomoAuth,
    model_id: str,
    body: dict | None = None,
    name: str | None = None,
    description: str | None = None,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Endpoint

  • PUT /datascience/ml/v1/models/{}

Called by

Source code in src/crew_dcs/routes/ai.py
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def update_ml_model(
    auth: DomoAuth,
    model_id: str,
    body: dict | None = None,
    name: str | None = None,
    description: str | None = None,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    url = (
        f"https://{auth.domo_instance}.domo.com/api/datascience/ml/v1/models/{model_id}"
    )
    request_body = body or {"id": model_id, "name": name, "description": description}
    res = await gd.get_data(
        auth=auth, url=url, method="PUT", body=request_body, context=context
    )
    if return_raw:
        return res
    if not res.is_success:
        raise AICRUDError(operation="update ml model", res=res, entity_id=model_id)
    return res

update_ml_model_ownership async

update_ml_model_ownership(
    auth: DomoAuth,
    model_id: str,
    user_id: int,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Endpoint

  • POST /datascience/ml/v1/models/{}/ownership

Called by

Source code in src/crew_dcs/routes/ai.py
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def update_ml_model_ownership(
    auth: DomoAuth,
    model_id: str,
    user_id: int,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    url = f"https://{auth.domo_instance}.domo.com/api/datascience/ml/v1/models/{model_id}/ownership"
    body = {"userId": user_id}
    res = await gd.get_data(
        auth=auth, url=url, method="POST", body=body, context=context
    )
    if return_raw:
        return res
    if not res.is_success:
        raise AICRUDError(
            operation="update ml model ownership", res=res, entity_id=model_id
        )
    return res

update_ml_project async

update_ml_project(
    auth: DomoAuth,
    project_id: str,
    body: dict | None = None,
    name: str | None = None,
    description: str | None = None,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Endpoint

  • PUT /datascience/ml/v1/projects/{}

Called by

Source code in src/crew_dcs/routes/ai.py
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def update_ml_project(
    auth: DomoAuth,
    project_id: str,
    body: dict | None = None,
    name: str | None = None,
    description: str | None = None,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    url = f"https://{auth.domo_instance}.domo.com/api/datascience/ml/v1/projects/{project_id}"
    request_body = body or {"id": project_id, "name": name, "description": description}
    res = await gd.get_data(
        auth=auth, url=url, method="PUT", body=request_body, context=context
    )
    if return_raw:
        return res
    if not res.is_success:
        raise AICRUDError(operation="update ml project", res=res, entity_id=project_id)
    return res

update_ml_project_ownership async

update_ml_project_ownership(
    auth: DomoAuth,
    project_id: str,
    user_id: int,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Endpoint

  • POST /datascience/ml/v1/projects/{}/ownership

Called by

Source code in src/crew_dcs/routes/ai.py
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def update_ml_project_ownership(
    auth: DomoAuth,
    project_id: str,
    user_id: int,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    url = f"https://{auth.domo_instance}.domo.com/api/datascience/ml/v1/projects/{project_id}/ownership"
    body = {"userId": user_id}
    res = await gd.get_data(
        auth=auth, url=url, method="POST", body=body, context=context
    )
    if return_raw:
        return res
    if not res.is_success:
        raise AICRUDError(
            operation="update ml project ownership", res=res, entity_id=project_id
        )
    return res

See also

Domo Knowledge Base categories

  • AI (Domo AI, MCP, assistant)