Skip to content

Commit

Permalink
⚡ [Enhance] Example Codes: Remove outdated snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
Hansimov committed Dec 11, 2023
1 parent 9e74f90 commit e65b0ea
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
10 changes: 1 addition & 9 deletions examples/chat_with_openai.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
from openai import OpenAI

# If runnning this service with proxy, you might need to unset `http(s)_proxy`.
base_url = "http://localhost:22222"
api_key = "sk-xxxxx"


client = OpenAI(base_url=base_url, api_key=api_key)

extra_body = {
"invocation_id": 1,
}

response = client.chat.completions.create(
model="precise",
messages=[
Expand All @@ -19,15 +14,12 @@
}
],
stream=True,
extra_body=extra_body,
)

# print(response)
for chunk in response:
if chunk.choices[0].delta.content is not None:
print(chunk.choices[0].delta.content, end="", flush=True)
elif chunk.choices[0].finish_reason == "stop":
print()
else:
# print(chunk)
pass
2 changes: 0 additions & 2 deletions examples/chat_with_post.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
chat_api = "http://localhost:22222"
api_key = "sk-xxxxx"
requests_headers = {}

requests_payload = {
"model": "precise",
"messages": [
Expand All @@ -17,7 +16,6 @@
}
],
"stream": True,
"invocation_id": 1,
}

with httpx.stream(
Expand Down

0 comments on commit e65b0ea

Please sign in to comment.