We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
from openai import OpenAI # 导入OpenAI
client = OpenAI(api_key="sk-123456", base_url="http://localhost:11434/v1") # 实例化OpenAI对象
response = client.chat.completions.create( model="deepseek-r1:14b", messages=[ {"role": "user", "content": "常见的十字花科植物有哪些?"} ], stream=False )
print(response.choices[0].message.content) # 输出文案
The text was updated successfully, but these errors were encountered:
from openai import OpenAI # 导入OpenAI deepseek model client = OpenAI(api_key="sk-123456", base_url="http://localhost:11434/v1") # 实例化OpenAI对象 use deepseek model response = client.chat.completions.create( model="deepseek-r1:14b", messages=[ {"role": "user", "content": "常见的十字花科植物有哪些?"} ], stream=False ) print(response.choices[0].message.content) # 输出文案
如果与OpenAi的输入与输出的格式相同,那么Platform选择OPENAI即可。 如果你是spring boot应用,可以直接在yml配置,第三方平台对应的url, apikey 例如:
ai: openai: api-host: https://xxxxx.xxxxx.com/ chat-completion-url: /my/v1/chat/completion api-key: abcdefg
非spring boot应用可以修改config:
OpenAiConfig openAiConfig = new OpenAiConfig(); openAiConfig.setApiHost("https://xxxxx.xxxxx.com/"); openAiConfig.setChatCompletionUrl("/my/v1/chat/completion"); openAiConfig.setApiKey("abcdefg"); configuration.setOpenAiConfig(openAiConfig);
请求参数的传递以及返回对象均与OpenAi的相同。
Sorry, something went wrong.
好滴 谢谢大佬~~
No branches or pull requests
from openai import OpenAI # 导入OpenAI
deepseek model
client = OpenAI(api_key="sk-123456", base_url="http://localhost:11434/v1") # 实例化OpenAI对象
use deepseek model
response = client.chat.completions.create(
model="deepseek-r1:14b",
messages=[
{"role": "user", "content": "常见的十字花科植物有哪些?"}
],
stream=False
)
print(response.choices[0].message.content) # 输出文案
The text was updated successfully, but these errors were encountered: