chatanywhere / GPT_API_free

Free ChatGPT API Key,免费ChatGPT API,支持GPT4 API(免费),ChatGPT国内可用免费转发API,直连无需代理。可以搭配ChatBox等软件/插件使用,极大降低接口使用成本。国内即可无限制畅快聊天。
MIT License
24.71k stars 1.87k forks source link

embeddings可以通过client.embeddings.create()的方式调用吗 #263

Closed CharryJay closed 3 months ago

CharryJay commented 4 months ago

看到api文档中可以如下使用embedding模型 url = "https://api.chatanywhere.tech/v1/embeddings" payload = json.dumps({ "model": "text-embedding-3-small", "input": "The food was delicious and the waiter..." }) headers = { 'Authorization': '[key]', 'User-Agent': 'Apifox/1.0.0 (https://apifox.com)', 'Content-Type': 'application/json' } response = requests.request("POST", url, headers=headers, data=payload)

请问能否像openai一样的接口调用呢embedding模型呢 from openai import OpenAI client = OpenAI() response = client.embeddings.create( input="Your text string goes here", model="text-embedding-3-small" )

ynpl commented 4 months ago

可以啊 改api地址就行了