メインコンテンツへスキップ
見出し画像

llama.cpp が TypeSafe の Jev 互換 API に対応したので動かしたメモ

    huggingface の記事

    エンドポイント

    /v1/systemone

    対応モデル

    ModelSizeLanguagesImagesJulia-1144M50+noLaya421MEnglishnoKev-4B4BEnglishnolev4BEnglishnoOpenJev27Ben, de, fr, hi, zh, jayes\newcommand{\arraystretch}{1.5} % \begin{array}{|l|l|l|l|} \hline \text{Model} & \text{Size} & \text{Languages} & \text{Images} \cr \hline \text{Julia-1} & \text{144M} & \text{50+} & \text{no} \cr \hline \text{Laya} & \text{421M} & \text{English} & \text{no} \cr \hline \text{Kev-4B} & \text{4B} & \text{English} & \text{no} \cr \hline \text{lev} & \text{4B} & \text{English} & \text{no} \cr \hline \text{OpenJev} & \text{27B} & \text{en, de, fr, hi, zh, ja} & \text{yes} \cr \hline \end{array}

    起動

    llama serve -hf ggml-org/Julia-1-GGUF:BF16

    試す

    curl http://localhost:8080/v1/systemone \
      -H "Content-Type: application/json" \
      -d '{
        "state": "お客様からのメッセージ:先週の注文で代金を二重に請求されましたが、どなたからも返信がありません。",
        "questions": {
          "担当部署": {
            "type": "choice",
            "instructions": "どのチームがこれを担当すべきでしょうか?",
            "criteria": {
              "請求": "支払い、手数料、返金、請求書",
              "配送": "配送、追跡、紛失・遅延した荷物",
              "技術": "バグ、エラー、ログインの問題"
            }
          },
          "怒り": {
            "type": "noul",
            "instructions": "お客様は怒っていますか?"
          },
          "緊急度": {
            "type": "score",
            "instructions": "これはどの程度緊急ですか?",
            "criteria": ["後回しにできる", "今週", "今日", "今すぐ"]
          }
        }
      }'

    結果

    {
      "model": "ggml-org/Julia-1-GGUF:BF16",
      "answers": {
        "担当部署": {
          "type": "choice",
          "choice": "請求",
          "probabilities": {
            "請求": 0.9999374837352517,
            "配送": 0.00005505047374999806,
            "技術": 0.00000746579099830683
          },
          "confidence": 0.9999062256028776
        },
        "怒り": {
          "type": "noul",
          "noul": 0.6934669237026129
        },
        "緊急度": {
          "type": "score",
          "score": 2.8822487091589477,
          "legend": {
            "0": "後回しにできる",
            "1": "今週",
            "2": "今日",
            "3": "今すぐ"
          },
          "probabilities": {
            "0": 0.03670861107775834,
            "1": 0.002912215603152928,
            "2": 0.0018010264014715646,
            "3": 0.9585781469176171
          },
          "confidence": 0.8822487091589476
        }
      },
      "usage": {
        "input_tokens": 164,
        "output_tokens": 0
      }
    }
    • 担当部署

      • 「請求」部署が担当すべき。確率は 0.9999 でほぼ確実。

    • 怒り

      • 「怒っている」確率は 0.69 。やや怒っている寄り。

    • 緊急度

      • 緊急度は「今すぐ」(確率 0.96) とほぼ断定。

    以上


    あなたへのおすすめ