mirror of
https://github.com/vllm-project/vllm.git
synced 2026-06-06 00:16:14 +00:00
[Bugfix] Fix broken example opeanai client (#41088)
Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
This commit is contained in:
@@ -25,7 +25,6 @@ import os
|
||||
import pybase64 as base64
|
||||
import requests
|
||||
from openai import OpenAI
|
||||
from utils import get_first_model
|
||||
|
||||
from vllm.utils.argparse_utils import FlexibleArgumentParser
|
||||
|
||||
@@ -407,7 +406,7 @@ def parse_args():
|
||||
|
||||
def main(args) -> None:
|
||||
chat_type = args.chat_type
|
||||
model = get_first_model(client)
|
||||
model = client.models.list().data[0].id
|
||||
example_function_map[chat_type](model, args.max_completion_tokens)
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ Environment variables:
|
||||
"""
|
||||
|
||||
from openai import OpenAI
|
||||
from utils import get_first_model
|
||||
|
||||
|
||||
def example_no_filter():
|
||||
@@ -30,7 +29,7 @@ def example_no_filter():
|
||||
|
||||
base_url = "http://0.0.0.0:8000/v1"
|
||||
client = OpenAI(base_url=base_url, api_key="empty")
|
||||
model = get_first_model(client)
|
||||
model = client.models.list().data[0].id
|
||||
|
||||
response = client.responses.create(
|
||||
model=model,
|
||||
@@ -59,7 +58,7 @@ def example_wildcard():
|
||||
|
||||
base_url = "http://0.0.0.0:8000/v1"
|
||||
client = OpenAI(base_url=base_url, api_key="empty")
|
||||
model = get_first_model(client)
|
||||
model = client.models.list().data[0].id
|
||||
|
||||
response = client.responses.create(
|
||||
model=model,
|
||||
@@ -95,7 +94,7 @@ def example_specific_tools():
|
||||
|
||||
base_url = "http://0.0.0.0:8000/v1"
|
||||
client = OpenAI(base_url=base_url, api_key="empty")
|
||||
model = get_first_model(client)
|
||||
model = client.models.list().data[0].id
|
||||
|
||||
response = client.responses.create(
|
||||
model=model,
|
||||
@@ -126,7 +125,7 @@ def example_object_format():
|
||||
|
||||
base_url = "http://0.0.0.0:8000/v1"
|
||||
client = OpenAI(base_url=base_url, api_key="empty")
|
||||
model = get_first_model(client)
|
||||
model = client.models.list().data[0].id
|
||||
|
||||
response = client.responses.create(
|
||||
model=model,
|
||||
|
||||
@@ -14,7 +14,6 @@ vllm serve Qwen/Qwen3-1.7B --reasoning-parser qwen3 \
|
||||
import json
|
||||
|
||||
from openai import OpenAI
|
||||
from utils import get_first_model
|
||||
|
||||
|
||||
def get_weather(latitude: float, longitude: float) -> str:
|
||||
@@ -51,7 +50,7 @@ input_messages = [
|
||||
def main():
|
||||
base_url = "http://0.0.0.0:8000/v1"
|
||||
client = OpenAI(base_url=base_url, api_key="empty")
|
||||
model = get_first_model(client)
|
||||
model = client.models.list().data[0].id
|
||||
response = client.responses.create(
|
||||
model=model, input=input_messages, tools=tools, tool_choice="required"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user