FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
autogen/python/samples/task_centric_memory/utils.py at main · microsoft/autogen · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
microsoft
/
autogen
Public
Notifications
You must be signed in to change notification settings
Fork
9.2k
Star
60.7k
Code
Issues
547
Pull requests
449
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
autogen
/
python
/
samples
/
task_centric_memory
/
utils.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
32 lines (26 loc) · 861 Bytes
Breadcrumbs
autogen
/
python
/
samples
/
task_centric_memory
/
utils.py
Copy path
File metadata and controls
32 lines (26 loc) · 861 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from
typing
import
Any
,
Dict
import
yaml
from
autogen_core
.
models
import
(
ChatCompletionClient
,
)
from
autogen_ext
.
models
.
openai
import
OpenAIChatCompletionClient
def
create_oai_client
(
config
:
Dict
[
str
,
Any
])
->
ChatCompletionClient
:
"""
Creates a chat completion client from OpenAI.
"""
client
=
OpenAIChatCompletionClient
(
model
=
config
[
"model"
],
max_tokens
=
config
[
"max_completion_tokens"
],
max_retries
=
config
[
"max_retries"
],
temperature
=
config
[
"temperature"
],
presence_penalty
=
config
[
"presence_penalty"
],
frequency_penalty
=
config
[
"frequency_penalty"
],
top_p
=
config
[
"top_p"
],
)
return
client
def
load_yaml_file
(
file_path
:
str
)
->
Any
:
"""
Opens a file and returns its contents.
"""
with
open
(
file_path
,
"r"
)
as
file
:
return
yaml
.
safe_load
(
file
)
Back
|
FazBrowse Home
|
New Git URL