[Bugfix] Fix broken example opeanai client (#41088)
Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
This commit is contained in:
@@ -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