一、ollama的连通性测试

参考文档:API 参考 - Ollama中文网

 1.使用api测试ollama qwen大模型的连通性

curl --location --request POST 'http://192.168.110.216:11434/api/generate' \
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
--header 'Content-Type: application/json' \
--data-raw '{
 "model": "qwen:7b",
 "prompt": "你好!",
 "stream": false
 }'

输出信息:

{
    "model": "qwen:7b",
    "created_at": "2024-07-16T09:50:46.903797271Z",
    "response": "你好!有什么我能帮你的吗?",
    "done": true,
    "done_reason": "stop",
    "context": [
        151644,
        872,
        ......
        11319
    ],
    "total_duration": 1200826373,
    "load_duration": 2290434,
    "prompt_eval_duration": 129797000,
    "eval_count": 9,
    "eval_duration": 1021756000
}

 2.使用api测试ollama m3e索引模型的连通性

注意:地址后缀要更改为/api/embeddings

curl --location --request POST 'http://192.168.110.216:11434/api/embeddings' \
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
--header 'Content-Type: application/json' \
--data-raw '{
 "model": "milkey/m3e:small-f16",
 "prompt": "你好!"
 }'

输出信息:

{
    "embedding": [
        0.001690375036559999,
        -0.5071032643318176,
        0.618750274181366,
        0.8972500562667847,
        -0.8042110800743103,
            ...省略...
        -1.357832431793213,
        -0.8816344141960144,
        0.8974659442901611,
        0.5146898627281189
    ]
}

二、oneAPi的连通性测试

参考文章:

一站式多模型管理:One API实用指南 (gameapp.club)

1.使用api测试one Api索引模型的连通性

注意:ip、Authorization、model需要换成自己的

请求信息:

curl --location --request POST 'http://ip:3001/v1/embeddings' \
--header 'Authorization: Bearer sk-uvkdLvi96pAwjpfv8a53EaCb20Eb4f69B483B388D7656b03' \
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
--header 'Content-Type: application/json' \
--data-raw '{
 "model":"milkey/m3e:small-f16",
 "input":"你好你好"
}'

输出信息:

{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [
        -0.1644720584154129,
        -0.3401753604412079,
        0.4924147427082062,
        0.7944067120552063,
        -1.106508731842041,
        -0.6042813658714294,
        -0.135698601603508,
        1.1983524560928345,
        1.0502504110336304,
        0.39524030685424805,
                ......
        1.7453641891479492,
        0.753643810749054,
        -1.10323965549469,
        -0.452385276556015,
        0.9913195371627808,
        0.6946268677711487
      ]
    }
  ],
  "model": "text-embedding-v1",
  "usage": {
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "total_tokens": 0
  }
}

2.使用api测试oneApi大模型的连通性

注意:ip、Authorization、model需要换成自己的

model可以换成本地部署的模型,确认模型名称是否正确

curl --location --request POST 'http://ip:3001/v1/chat/completions' \
--header 'Authorization: Bearer sk-uvkdLvi96pAwjpfv8a53EaCb20Eb4f69B483B388D7656b03' \
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
--header 'Content-Type: application/json' \
--data-raw '{
 "model":"qwen:7b",
 "messages": [{"role": "user", "content": "你是哪个公司的大模型"}]
}'

输出信息:

{
    "id": "chatcmpl-8dc2c903ffe34d7a87becd127cdf6971",
    "model": "qwen:7b",
    "object": "chat.completion",
    "created": 1721122587,
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "我是阿里云研发的语言模型,名叫通义千问。"
            },
            "finish_reason": "stop"
        }
    ],
    "usage": {
        "prompt_tokens": 10,
        "completion_tokens": 14,
        "total_tokens": 24
    }
}

三、fastgpt的连通性测试

参考文章:FastGPT Open API

以下引用官方文档示例

1.使用api测试fastgpt 应用模型的连通性 

curl --location --request POST 'http://localhost:3000/api/v1/chat/completions' \
--header 'Authorization: Bearer test-xxxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
    "stream": false,
    "chatId": "test",
    "variables": {
        "query":"你好" # 我的插件输入有一个参数,变量名叫 query
    }
}'

正确输出:

{
    "responseData": [
        {
            "nodeId": "fdDgXQ6SYn8v",
            "moduleName": "AI 对话",
            "moduleType": "chatNode",
            "totalPoints": 0.685,
            "model": "FastAI-3.5",
            "tokens": 685,
            "query": "你好",
            "maxToken": 2000,
            "historyPreview": [
                {
                    "obj": "Human",
                    "value": "你好"
                },
                {
                    "obj": "AI",
                    "value": "你好!有什么可以帮助你的吗?欢迎向我提问。"
                }
            ],
            "contextTotalLen": 14,
            "runningTime": 1.73
        },
        {
            "nodeId": "pluginOutput",
            "moduleName": "自定义插件输出",
            "moduleType": "pluginOutput",
            "totalPoints": 0,
            "pluginOutput": {
                "result": "你好!有什么可以帮助你的吗?欢迎向我提问。"
            },
            "runningTime": 0
        }
    ],
    "newVariables": {
        "query": "你好"
    },
    "id": "safsafsa",
    "model": "",
    "usage": {
        "prompt_tokens": 1,
        "completion_tokens": 1,
        "total_tokens": 1
    },
    "choices": [
        {
            "message": {
                "role": "assistant",
                "content": "你好!有什么可以帮助你的吗?欢迎向我提问。"
            },
            "finish_reason": "stop",
            "index": 0
        }
    ]
}

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐