Cozeプラグイン — Doubao内で使用
Open Doubao → Plugin Store → search "FTIR" or "红外分析" → tap Add. No configuration needed. Doubao will automatically route infrared-related queries to our spectral search engine.
検索キーワード:赤外分析, FTIR, infrared, スペクトル検索, 物質識別
REST API
ライブラリ検索API
POST
/v1/search
スペクトルライブラリ検索。ファイル(全スペクトルマッチング)またはピークリスト(ピーク位置マッチング)を受け付けます。両方が指定された場合、ファイル検索が優先されます。
認証
X-API-Key: your-api-key
リクエスト本文
| フィールド | タイプ | 必須 | 説明 |
| file_base64 | string | いずれか | Base64エンコードされた機器ファイル(CSV、SPA、OPUS、SPC、JCAMP-DX、その他15以上のフォーマットをサポート) |
| filename | string | file_base64を使用 | 元のファイル名(拡張子を含む、例:sample.spa) |
| peaks | number[] | いずれか | ピーク波数(cm⁻¹)のリスト(例:[3026, 1601, 1493, 755]) |
| top_k | integer | いいえ(デフォルト10) | 返す結果の数、最大50 |
| tolerance | integer | いいえ(デフォルト8) | ピークマッチトレランス(cm⁻¹)、範囲1~30 |
レスポンス
{
"success": true,
"search_mode": "full_spectrum",
"n_matches": 10,
"matches": [
{
"rank": 1,
"name": "Polystyrene",
"cas": "25086-18-4",
"num": 326,
"similarity": 0.9586
}
],
"file_format": "Thermo SPA",
"n_points": 3601,
"error": null
}
例 — ファイルアップロード
import base64, requests
with open("sample.spa", "rb") as f:
b64 = base64.b64encode(f.read()).decode()
resp = requests.post(
"https://api.ftir.fun/v1/search",
headers={"X-API-Key": "your-key", "Content-Type": "application/json"},
json={"file_base64": b64, "filename": "sample.spa", "top_k": 5},
)
print(resp.json())
例 — ピークリスト
import requests
resp = requests.post(
"https://api.ftir.fun/v1/search",
headers={"X-API-Key": "your-key", "Content-Type": "application/json"},
json={"peaks": [3082, 3026, 2923, 1601, 1493, 1451, 1028, 906, 755, 699], "top_k": 5},
)
print(resp.json())
既存結果のためのAIのみの分析
検索結果が既に存在する場合にのみこのエンドポイントを使用してください。FTIR.funはまず提供されたレポートを読み取るかOCRし、報告された候補とサンプルピークテーブルを抽出し、その後下流のKGおよび文献に基づく分析を実行します。
POST
/ftir/analyze_existing_results
レポートには報告された検索結果リストとサンプルピークテーブルの両方が含まれている必要があります。このエンドポイントは単独でスペクトルライブラリ検索を実行しません。
認証
X-API-Key: your-api-key
リクエスト本文
| フィールド | タイプ | 必須 | 説明 |
| report_text | string | いずれか | 既存の機器またはライブラリレポートからコピーされたプレーンテキスト。テキストには報告された結果とサンプルピークテーブルの両方が含まれている必要があります。 |
| report_file_base64 | string | いずれか | Base64エンコードされたレポートファイル。サポートされている形式:PDF、DOC、DOCX、TXT、CSV、PNG、JPG、JPEG、WEBP、GIF、BMP、TIF、TIFF。 |
| report_filename | string | report_file_base64を使用 | 拡張子を含む元のレポートファイル名(例:report.pdfまたはreport.docx)。 |
| user_background_text | string | いいえ | オプションのサンプル背景。これはソフトコンテキストとしてのみ扱われ、証拠としては扱われません。 |
厳格な入力境界
- 必須要素1:少なくとも1つの報告された検索結果候補(Top1ヒットやTop15リストなど)
- 必須要素2:同じレポートからのcm-1単位のサンプルピークリストまたはピークテーブル
- いずれかの要素が欠けている場合、エンドポイントはHTTP 422を返し、分析レポートを生成しません
成功応答
{
"success": true,
"analysis_mode": "ai_only_existing_results",
"message": "AI-only analysis completed from the supplied existing results report.",
"input_requirements": {
"service_boundary": "AI-only analysis starts after a search result already exists.",
"required_inputs": [
"At least one reported search result candidate (Top1 or Top15).",
"The sample peak table or peak list in cm-1."
]
},
"missing_requirements": [],
"missing_requirement_messages": [],
"extracted_report": {
"source_kind": "pdf",
"used_ocr": true,
"peak_values_cm1": [1736, 1601, 1241],
"library_candidates": [
{"rank": 1, "name": "Polyethylene terephthalate", "cas_number": "25038-59-9", "raw_score_text": "856/1000", "normalized_similarity": 0.856}
]
},
"summary": "Reported library results rank Polyethylene terephthalate first.",
"report_view": {},
"final_decision": {},
"direct_evidence": {},
"related_literature": {}
}
入力不足応答
{
"detail": {
"success": false,
"analysis_mode": "ai_only_existing_results",
"error": "missing_required_report_elements",
"message": "AI-only analysis requires both reported library results and a sample peak table.",
"missing_requirements": ["sample_peak_table"],
"missing_requirement_messages": [
"Missing sample peak table. Provide the sample peak list or peak table in cm-1 from the same report."
],
"input_requirements": {
"failure_behavior": "If either the reported result list or the sample peak table is missing, the service stops and returns a 422 response."
},
"extracted_report": {
"report_has_library_results": true,
"report_has_peak_table": false
}
}
}
例 — 既存のレポートテキスト
import requests
report_text = """
Sample: PET fragment
Top1: Polyethylene terephthalate Score: 856/1000
Top2: Polyester resin Score: 801/1000
Peak table (cm-1): 3435, 2932, 1715, 1409, 1241, 1093, 1017, 872, 722
"""
resp = requests.post(
"https://api.ftir.fun/ftir/analyze_existing_results",
headers={"X-API-Key": "your-key", "Content-Type": "application/json"},
json={"report_text": report_text, "user_background_text": "consumer packaging fragment"},
)
print(resp.json())
例 — 既存のレポートファイル
import base64, requests
with open("instrument-report.pdf", "rb") as f:
b64 = base64.b64encode(f.read()).decode()
resp = requests.post(
"https://api.ftir.fun/ftir/analyze_existing_results",
headers={"X-API-Key": "your-key", "Content-Type": "application/json"},
json={
"report_file_base64": b64,
"report_filename": "instrument-report.pdf",
"user_background_text": "suspected packaging adhesive",
},
)
print(resp.json())