Validation / Typecheck (push) Has been cancelled
Validation / Style (push) Has been cancelled
Validation / Test macos-latest (push) Has been cancelled
Validation / Test ubuntu-latest (push) Has been cancelled
Validation / Test windows-latest (push) Has been cancelled
Validation / Build (push) Has been cancelled
Validation / Required (push) Has been cancelled
Run mypy_primer on push / Run mypy_primer on push (push) Has been cancelled
- Rewrite root README and docs for Vipeye - Rename pyright-test-policy to vipeye-test-policy - Update CI/Azure pipelines, perfCompare.py and package metadata - Keep upstream links, external tool params and # pyright: ignore compat"
18 lines
442 B
Python
18 lines
442 B
Python
from openai import OpenAI
|
|
|
|
# 指向本地Ollama服务,不是OpenAI官网
|
|
client = OpenAI(
|
|
base_url="http://127.0.0.1:11434/v1",
|
|
api_key="dummy" # 本地模式key无校验,随便填写占位字符串
|
|
)
|
|
|
|
resp = client.chat.completions.create(
|
|
model="qwen3.5:4b",
|
|
messages=[
|
|
{"role":"user","content":"你好"}
|
|
],
|
|
max_tokens=1024,
|
|
temperature=0.7
|
|
)
|
|
|
|
print(resp.choices[0].message.content) |