Download code/test.py from NOTavaliable/RAG: direct link, hf CLI and curl.
- Browser
- Download file 600 Bytes
-
https://huggingface.co/NOTavaliable/RAG/resolve/main/code/test.py
- Command line
-
hf download hf://NOTavaliable/RAG/code/test.py
-
curl -L -o test.py https://huggingface.co/NOTavaliable/RAG/resolve/main/code/test.py
600 Bytes
| from openai import OpenAI | |
| client = OpenAI( | |
| base_url="http://127.0.0.1:8000/v1", | |
| api_key="EMPTY", # vLLM 默认通常不校验 API Key | |
| ) | |
| response = client.chat.completions.create( | |
| model="qwen2.5-32b-instruct", # 必须与 --served-model-name 一致 | |
| messages=[ | |
| { | |
| "role": "system", | |
| "content": "You are a helpful assistant.", | |
| }, | |
| { | |
| "role": "user", | |
| "content": "简单介绍一下检索增强生成(RAG)。", | |
| }, | |
| ], | |
| temperature=0, | |
| max_tokens=512, | |
| ) | |
| print(response.choices[0].message.content) |