mirror of
https://github.com/NVIDIA/TensorRT-LLM.git
synced 2026-01-14 06:27:45 +08:00
Signed-off-by: Superjomn <328693+Superjomn@users.noreply.github.com> Signed-off-by: Erin Ho <14718778+hchings@users.noreply.github.com> Co-authored-by: Erin Ho <14718778+hchings@users.noreply.github.com>
16 lines
299 B
Python
16 lines
299 B
Python
### :title OpenAI Completion Client
|
|
|
|
from openai import OpenAI
|
|
|
|
client = OpenAI(
|
|
base_url="http://localhost:8000/v1",
|
|
api_key="tensorrt_llm",
|
|
)
|
|
|
|
response = client.completions.create(
|
|
model="TinyLlama-1.1B-Chat-v1.0",
|
|
prompt="Where is New York?",
|
|
max_tokens=20,
|
|
)
|
|
print(response)
|