-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6107 from duanjunwen/dev/zero_bubble
[Zerobubble] Merge Main.
- Loading branch information
Showing
60 changed files
with
1,685 additions
and
834 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
applications/ColossalChat/coati/reasoner/guided_search/llm.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import openai | ||
from openai.types.chat.chat_completion import ChatCompletion | ||
from openai.types.chat.chat_completion_message_param import ChatCompletionMessageParam | ||
|
||
API_KEY = "Dummy API Key" | ||
|
||
|
||
def get_client(base_url: str | None = None) -> openai.Client: | ||
return openai.Client(api_key=API_KEY, base_url=base_url) | ||
|
||
|
||
def chat_completion( | ||
messages: list[ChatCompletionMessageParam], | ||
model: str, | ||
base_url: str | None = None, | ||
temperature: float = 0.8, | ||
**kwargs, | ||
) -> ChatCompletion: | ||
client = get_client(base_url) | ||
response = client.chat.completions.create( | ||
model=model, | ||
messages=messages, | ||
temperature=temperature, | ||
**kwargs, | ||
) | ||
return response |
Oops, something went wrong.