Git Product home page Git Product logo

sparkdesk-api's Introduction

sparkdesk-api 讯飞星火大模型api

如果该项目对你有帮助,不要忘记给我点个 star 哦!

使用方法

pip install sparkdesk-api==1.0.3

或者

pip install sparkdesk-api==1.0.3 -i https://pypi.org/simple

1. Web模式

Web模式下,需要前往讯飞星火大模型web端通过 F12 抓取 3 个参数:cookie、fd、GtToken

命令行操作

python sparkdesk_web_cli.py

api调用

  • chat():一次询问
  • chat_stream():连续询问,相当于命令行模式
from sparkdesk_web.core import SparkWeb

sparkWeb = SparkWeb(
     cookie=cookie,
     fd=fd,
     GtToken=GtToken
 )

 # single chat
 print(sparkWeb.chat("repeat: hello world"))
 # continue chat
 sparkWeb.chat_stream()

2. API模式

讯飞星火的API需要前往官网进行申请。 你可以先创建一个服务,然后在该服务的控制台页面左边的:“星火认知大模型”栏目,进入“合作咨询”页面进行申请。 一般使用公司邮箱申请速度快。

该模式需要 3 个参数:app_id、api_key、api_secret

from sparkdesk_api.core import SparkAPI
sparkAPI = SparkAPI(
    app_id="",
    api_secret="",
    api_key=""
)
sparkAPI.chat_stream()

具体调用方法与相关调用函数与 Web 模式一致。

sparkdesk-api's People

Contributors

harcicyang avatar hildam avatar jimouchen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.