ABEJA OpsBeeLLM SDK documentation

ABEJA OpsBeeLLM library is SDK for python, which allows developers to create, get and delete OpsBeeLLM resources.

Low level API

Low level API directly accesses the API endpoints.

Usage

from abeja.opsbeellm.history import APIClient as OpsBeeLLMHisotryAPIClient

credential = {"user_id": "user-1111111111111", "personal_access_token": "dummy"}

try:
   resp_history = OpsBeeLLMHistoryAPIClient(credential=credential).create_qa_history(
         organization_id="1111111111111",               # [Required] オーガニゼーションIDを指定してください
         deployment_id="2222222222222",                 # [Required] 作成したデプロイメントのIDを指定してください
         input_text="ABEJAについて教えて",                 # [Required] LLM への入力文を入力してください
         output_text="ABEJAは、スペイン語で「ミツバチ」の意味であり、植物の受粉を手伝い、世界の食料生産を支える存在として社名になっています。",  # [Required] LLM からの応答文を入力してください
         input_token_count=None,                        # [Optional] 必要に応じて、LLM への入力文のトークン数を指定してください。
         output_token_count=None,                       # [Optional] 必要に応じて、LLM からの出力文のトークン数を指定してください。
         tag_ids=[                                      # [Optional] 必要に応じて、入出力履歴に付与するためのタグのIDを List 型で設定してください。タグはあとからでも追加できます。
            '3333333333333',
            '4444444444444',
         ],
         metadata=[                                     # [Optional] 必要に応じて、入出力ペア履歴に関連付けさせたい key-value 形式のメタデータを List[dict] 型で設定してください。メタデータはあとからでも設定できます
            {"関連部署": "ABEJA全体"},
            {"model_name": "gpt-3.5-turbo-0613"},
            {"temperature": "0.0"},
         ],
      )
   print("resp_history: ", resp_history)
except Exception as e:
   print(f'Faild to create qa history | {e}')

API Mapping (OpsBeeLLM Deployment)

method

path

description

post

/opsbee-llm/organizations/<organization_id>/deployments

APIClient.create_deployment()

get

/opsbee-llm/organizations/<organization_id>/deployments

APIClient.get_deployments()

get

/opsbee-llm/organizations/<organization_id>/deployments/<deployment_id>

APIClient.get_deployment()

delete

/opsbee-llm/organizations/<organization_id>/deployments/<deployment_id>

APIClient.delete_deployment()

patch

/opsbee-llm/organizations/<organization_id>/deployments/<deployment_id>

APIClient.update_deployment()

API Mapping (OpsBeeLLM Thread)

method

path

description

post

/opsbee-llm/organizations/<organization_id>/deployments/<deployment_id>/threads

APIClient.create_thread()

get

/opsbee-llm/organizations/<organization_id>/deployments/<deployment_id>/threads

APIClient.get_threads()

get

/opsbee-llm/organizations/<organization_id>/deployments/<deployment_id>/threads/<thread_id>

APIClient.get_thread()

delete

/opsbee-llm/organizations/<organization_id>/deployments/<deployment_id>/threads/<thread_id>

APIClient.delete_thread()

patch

/opsbee-llm/organizations/<organization_id>/deployments/<deployment_id>/threads/<thread_id>

APIClient.update_thread()

API Mapping (OpsBeeLLM History)

method

path

description

post

/opsbee-llm/organizations/<organization_id>/deployments/<deployment_id>/qa_histories

APIClient.create_qa_history()

get

/opsbee-llm/organizations/<organization_id>/deployments/<deployment_id>/qa_histories

APIClient.get_qa_histories()

get

/opsbee-llm/organizations/<organization_id>/deployments/<deployment_id>/qa_histories/<history_id>

APIClient.get_qa_history()

delete

/opsbee-llm/organizations/<organization_id>/deployments/<deployment_id>/qa_histories/<history_id>

APIClient.delete_qa_history()

patch

/opsbee-llm/organizations/<organization_id>/deployments/<deployment_id>/qa_histories/<history_id>

APIClient.update_qa_history()

post

/opsbee-llm/organizations/<organization_id>/deployments/<deployment_id>/qa_histories/dataset/<dataset_id>/items

APIClient.add_qa_histories_to_dataset()

post

/opsbee-llm/organizations/<organization_id>/deployments/<deployment_id>/threads/<thread_id>/histories

APIClient.create_chat_history()

get

/opsbee-llm/organizations/<organization_id>/deployments/<deployment_id>/threads/<thread_id>/histories

APIClient.get_chat_histories()

get

/opsbee-llm/organizations/<organization_id>/deployments/<deployment_id>/threads/<thread_id>/histories/<history_id>

APIClient.get_chat_history()

delete

/opsbee-llm/organizations/<organization_id>/deployments/<deployment_id>/threads/<thread_id>/histories/<history_id>

APIClient.delete_chat_history()

patch

/opsbee-llm/organizations/<organization_id>/deployments/<deployment_id>/threads/<thread_id>/histories/<history_id>

APIClient.update_chat_history()

post

/opsbee-llm/organizations/<organization_id>/deployments/<deployment_id>/histories/dataset/<dataset_id>/items

APIClient.add_chat_histories_to_dataset()

API Mapping (OpsBeeLLM History Metadata)

method

path

description

post

/opsbee-llm/organizations/<organization_id>/deployments/<deployment_id>/qa_histories/<history_id>/metadata

APIClient.create_qa_history_metadata()

delete

/opsbee-llm/organizations/<organization_id>/deployments/<deployment_id>/qa_histories/<history_id>/metadata

APIClient.delete_qa_history_metadata()

patch

/opsbee-llm/organizations/<organization_id>/deployments/<deployment_id>/qa_histories/<history_id>/metadata

APIClient.update_qa_history_metadata()

post

/opsbee-llm/organizations/<organization_id>/deployments/<deployment_id>/threads/<thread_id>/histories/<history_id>/metadata

APIClient.create_chat_history_metadata()

delete

/opsbee-llm/organizations/<organization_id>/deployments/<deployment_id>/threads/<thread_id>/histories/<history_id>/metadata

APIClient.delete_chat_history_metadata()

patch

/opsbee-llm/organizations/<organization_id>/deployments/<deployment_id>/threads/<thread_id>/histories/<history_id>/metadata

APIClient.update_chat_history_metadata()

API Mapping (OpsBeeLLM Tags)

method

path

description

post

/opsbee-llm/organizations/<organization_id>/tags

APIClient.create_tag()

get

/opsbee-llm/organizations/<organization_id>/tags

APIClient.get_tags()

get

/opsbee-llm/organizations/<organization_id>/tags/<tag_id>

APIClient.get_tag()

delete

/opsbee-llm/organizations/<organization_id>/tags/<tag_id>

APIClient.delete_tag()

patch

/opsbee-llm/organizations/<organization_id>/tags/<tag_id>

APIClient.update_tag()

API Mapping (OpsBeeLLM Dataset)

method

path

description

post

/opsbee-llm/organizations/<organization_id>/datasets

APIClient.create_dataset()

get

/opsbee-llm/organizations/<organization_id>/datasets

APIClient.get_datasets()

get

/opsbee-llm/organizations/<organization_id>/datasets/<dataset_id>

APIClient.get_dataset()

delete

/opsbee-llm/organizations/<organization_id>/datasets/<dataset_id>

APIClient.delete_dataset()

patch

/opsbee-llm/organizations/<organization_id>/datasets/<dataset_id>

APIClient.update_dataset()

post

/opsbee-llm/organizations/<organization_id>/datasets/<dataset_id>/items

APIClient.create_dataset_item()

get

/opsbee-llm/organizations/<organization_id>/datasets/<dataset_id>/items

APIClient.get_dataset_items()

get

/opsbee-llm/organizations/<organization_id>/datasets/<dataset_id>/items/<item_id>

APIClient.get_dataset_item()

delete

/opsbee-llm/organizations/<organization_id>/datasets/<dataset_id>/items/<item_id>

APIClient.delete_dataset_item()

patch

/opsbee-llm/organizations/<organization_id>/datasets/<dataset_id>/items/<item_id>

APIClient.update_dataset_item()