跳转至

CRUD と更新 API

このページでは、現在の ORPC 専用 Search SDK が公開している作成、更新、削除、資料管理 API をまとめます。

フィールド名

create_*()update_*() の追加フィールドは **fields としてそのまま backend ORPC に渡されます。Python helper は snake_case を使い、namespace helper には一部 backend と同じ camelCase alias もあります。

呼び出しスタイル

from aimage.search.client import SearchClient
from aimage.search.settings import SearchService

with SearchClient(service=SearchService.DEV) as client:
    client.update_clip_subtitle("clip_id", "new subtitle")
    client.kensaku.clips.updateSubtitle("clip_id", "new subtitle")
    client.rpc("kensaku/clips/updateSubtitle", {
        "clip_id": "clip_id",
        "subtitle": "new subtitle",
    })

プロジェクト設定と機能フラグ

用途 Python helper Namespace
プロジェクト取得 get_project(project_id) client.kensaku.projects.get(project_id)
設定更新 update_project_settings(project_id, agent_model=..., feature_flags=...) client.kensaku.projects.updateSettings(project_id, ...)
機能フラグ設定 set_project_feature_flags(project_id, ...)
機能フラグ alias enable_project_features(project_id, ...)
client.set_project_feature_flags(
    "project_id",
    image_generation=True,
    translation_table=True,
    material_reading=True,
    clip_embedding_search=True,
)

project.update_settings(agent_model="gpt-4.1")
project.set_feature_flags(translation_table=True)
Python パラメータ Backend field
image_generation imageGeneration
translation_table translationTable
material_reading materialReading
clip_embedding_search clipEmbeddingSearch

キャラクター

用途 Python helper Namespace
一覧 list_characters(project_id, q=None) client.data.characters.list(project_id, q=...)
取得 get_character(character_id) client.data.characters.get(character_id)
作成 create_character(project_id, **fields) client.data.characters.create(project_id, **fields)
更新 update_character(character_id, **fields) client.data.characters.update(character_id, **fields)
削除 delete_character(character_id) client.data.characters.delete(character_id)

追加の資料 helper:

用途 Python helper
gallery 画像追加 add_character_gallery_image(character_id, file_path)
gallery 画像一括追加 add_character_gallery_images(character_id, file_paths)
gallery 画像削除 remove_character_gallery_image(character_id, index)
concept art 追加 add_character_concept_art(character_id, file_path)
concept art 一括追加 add_character_concept_art_batch(character_id, file_paths)
concept art 削除 remove_character_concept_art(character_id, index)
設定一覧 list_character_settings(character_id)
設定作成 create_character_setting(character_id, **fields)
設定更新 update_character_setting(setting_id, **fields)
設定削除 delete_character_setting(setting_id)
資料を設定へ割り当て assign_character_materials_to_setting(character_id, setting_id, file_paths)
資料の割り当て解除 unassign_character_materials_from_settings(character_id, file_paths)
character = client.create_character(
    "project_id",
    name="司",
    name_alias=["つかさ"],
    features=["blue eyes"],
)

client.update_character(character.id, is_pinned=True)
client.add_character_concept_art(character.id, "characters/tsukasa/concept.png")

リソースとその他資料

Resource はプロジェクト単位のファイル資料です。脚本、設定資料、参考資料、OCR 対象、翻訳表の元ファイルなどに使えます。

用途 Python helper Namespace
一覧 list_resources(project_id, **filters) client.data.resources.list(project_id, **filters)
取得 get_resource(resource_id) client.data.resources.get(resource_id)
作成 create_resource(project_id, **fields) client.data.resources.create(project_id, **fields)
更新 update_resource(resource_id, **fields) client.data.resources.update(resource_id, **fields)
削除 delete_resource(resource_id) client.data.resources.delete(resource_id)
アップロード URL 一括取得 batch_presigned_resource_urls(project_id, files) raw ORPC
フォルダ一覧 resource_folder_paths(project_id) raw ORPC
OCR 開始 start_material_ocr(project_id, resource_id, **fields) raw ORPC
OCR 進捗 material_ocr_progress(progress_id) raw ORPC
resource = project.create_resource(
    name="Character settings",
    file_path="materials/characters.pdf",
    file_type="resources",
    folder_path="materials",
)

client.update_resource(resource.id, description="Updated notes")
progress = client.start_material_ocr(project.id, resource.id, language="ja")

参考画像

用途 Python helper Namespace
一覧 list_reference_images(project_id, page=1, size=300, **filters) client.data.referenceImages.list(project_id, **filters)
検索 search_reference_images(project_id, page=1, size=40, **filters) client.data.referenceImages.search(project_id, **filters)
タグ候補 reference_image_tag_options(project_id, **filters) client.data.referenceImages.tag_options(project_id, **filters)
取得 get_reference_image(reference_image_id) client.data.referenceImages.get(reference_image_id)
作成 create_reference_image(project_id, **fields) client.data.referenceImages.create(project_id, **fields)
更新 update_reference_image(reference_image_id, **fields) client.data.referenceImages.update(reference_image_id, **fields)
削除 delete_reference_image(reference_image_id) client.data.referenceImages.delete(reference_image_id)
reference = client.create_reference_image(
    project.id,
    resource_id="resource_id",
    category="background_art",
    tags=["school", "day"],
    license="licensed",
    is_searchable=True,
)

client.update_reference_image(reference.id, tags=["school", "day", "interior"])

翻訳表

用途 Python helper Namespace
表一覧 list_translation_tables(project_id, page=1, size=300, **filters) client.data.translationTables.list(project_id, **filters)
表取得 get_translation_table(table_id) client.data.translationTables.get(table_id)
表作成 create_translation_table(project_id, **fields) client.data.translationTables.create(project_id, **fields)
表更新 update_translation_table(table_id, **fields) client.data.translationTables.update(table_id, **fields)
表削除 delete_translation_table(table_id) client.data.translationTables.delete(table_id)
entry 一覧 list_translation_table_entries(table_id, page=1, size=300, **filters) client.data.translationTables.entries.list(table_id, **filters)
entry 作成 create_translation_table_entry(table_id, raw_values, **fields) client.data.translationTables.entries.create(table_id, raw_values, **fields)
entry 更新 update_translation_table_entry(entry_id, **fields) client.data.translationTables.entries.update(entry_id, **fields)
entry 削除 delete_translation_table_entry(entry_id) client.data.translationTables.entries.delete(entry_id)
table = project.create_translation_table(
    name="Character names",
    columns=[
        {"key": "ja", "label": "日本語", "index": 0},
        {"key": "en", "label": "English", "index": 1},
        {"key": "zh", "label": "中文", "index": 2},
    ],
)

entry = client.create_translation_table_entry(
    table.id,
    raw_values={"ja": "司", "en": "Tsukasa", "zh": "司"},
)
client.update_translation_table_entry(
    entry.id,
    raw_values={"ja": "司", "en": "Tsukasa", "zh": "司"},
)

漫画と小説

用途 Manga helper Novel helper
一覧 list_mangas(project_id, **filters) list_novels(project_id, **filters)
取得 get_manga(meta_id) get_novel(meta_id)
作成 create_manga(project_id, **fields) create_novel(project_id, **fields)
更新 update_manga(meta_id, **fields) update_novel(meta_id, **fields)
削除 delete_manga(meta_id) delete_novel(meta_id)
処理状態 get_manga_processing(processing_id) / find_manga_processing_by_meta(meta_id) get_novel_processing(processing_id) / find_novel_processing_by_meta(meta_id)
client.query_novels(project.id, "confession scene", k=5)
client.get_novel_segment_context(project.id, "segment_id", context_radius=2)

Clip Metadata、タグ、キャラクター、字幕

用途 Python helper Namespace
取得 get_clip(clip_id) client.kensaku.clips.get(clip_id)
詳細取得 get_clip_detail(clip_id) client.kensaku.clips.getDetail(clip_id)
エピソード内 clip list_episode_clips(project_id, episode_number, ...) client.kensaku.clips.episodeClips(project_id, episode_number, ...)
Clip 更新 update_clip(clip_id, **fields) client.kensaku.clips.update(clip_id, **fields)
タグ更新 update_clip_tags(clip_id, tags, **fields) client.kensaku.clips.updateTags(clip_id, tags)
キャラクター更新 update_clip_characters(clip_id, character_ids) client.kensaku.clips.updateCharacters(clip_id, character_ids)
字幕更新 update_clip_subtitle(clip_id, subtitle) client.kensaku.clips.updateSubtitle(clip_id, subtitle)
clip = client.get_clip_detail("clip_id")
clip.update_subtitle("I remember this place.")
clip.update_characters(["character_id"])
clip.update_tags({"dialog_sentiment": "POSITIVE"})
clip.update(metadata={"notes": "checked by editor"})

Agent と会話ブランチ

用途 Python helper Namespace
プロジェクト context 読み取り agent_read_project_context(project_id) client.agent.read.projectContext(project_id)
タグ候補読み取り agent_read_tag_options(project_id) client.agent.read.tagOptions(project_id)
キャラクター読み取り agent_read_characters(project_id) client.agent.read.characters(project_id)
会話履歴読み取り agent_read_conversation_history(conversation_id, **fields) client.agent.read.conversationHistory(conversation_id, **fields)
clips 検索 agent_search_clips(project_id, query, **fields) client.agent.read.searchClips(project_id, query, **fields)
novels 検索 agent_search_novels(project_id, query, **fields) client.agent.read.searchNovels(project_id, query, **fields)
clips hydrate agent_hydrate_clips(clip_ids) client.agent.read.hydrateClips(clip_ids)
visual asset preview agent_visual_asset_preview(project_id, visual_asset_id) client.agent.read.visualAssetPreview(project_id, visual_asset_id)
生成画像保存 agent_save_generated_image(project_id, visual_asset_id, **fields) client.agent.write.saveGeneratedImage(project_id, visual_asset_id, **fields)
会話作成 create_conversation(project_id, title="新対話") client.kensaku.chatbot.conversations.create(project_id, title)
message 追加 add_conversation_message(conversation_id, message, **fields) client.kensaku.chatbot.conversations.addMessage(conversation_id, message, **fields)
message 編集 edit_conversation_message(conversation_id, message_id, content, **fields) client.kensaku.chatbot.conversations.editMessage(conversation_id, message_id, content, **fields)
ブランチ切替 switch_conversation_branch(conversation_id, message_id=None, branch_id=None) client.kensaku.chatbot.conversations.switchBranch(...)
conversation = client.create_conversation(project.id, title="Scene search")
message = client.add_conversation_message(conversation["id"], "Find school hallway cuts")
client.switch_conversation_branch(conversation["id"], message_id=message["id"])