Skip to content

Commit 4282717

Browse files
committed
model improv
1 parent 7098b66 commit 4282717

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "UniLM"
22
uuid = "2a65a866-de6b-4bc8-8daf-c130204fdf93"
33
authors = ["Marius Fersigan <[email protected]> and contributors"]
4-
version = "0.5.4"
4+
version = "0.5.6"
55

66
[deps]
77
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"

src/api.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ Base.show(io::IO, x::Model) = print(io, x.name)
8585
Base.parse(::Type{Model}, s::String) = Model(s)
8686

8787
const GPT4o = Model("gpt-4o")
88+
const GPT4oMini = Model("gpt-4o-mini")
8889
const GPT4Turbo = Model("gpt-4-1106-preview")
8990
const GPT4TurboVision = Model("gpt-4-vision-preview")
9091

src/constants.jl

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,20 @@ const _MODEL_ENDPOINTS_OPENAI::Dict{String,String} = Dict(
4545
Convenience mapping of OpenAI model names to their respective endpoints.
4646
4747
"""
48-
const _MODEL_ENDPOINTS_AZURE_OPENAI::Dict{String,String} = Dict(
49-
"gpt-4o" => "/openai/deployments/" * ENV["AZURE_OPENAI_DEPLOY_NAME_GPT_4O"],
50-
"gpt-4o-mini" => "/openai/deployments/" * ENV["AZURE_OPENAI_DEPLOY_NAME_GPT_4O_MINI"]
51-
)
48+
const _MODEL_ENDPOINTS_AZURE_OPENAI::Dict{String,String} = begin
49+
d = Dict()
50+
51+
if haskey(ENV, "AZURE_OPENAI_DEPLOY_NAME_GPT_4O")
52+
d["gpt-4o"] = "/openai/deployments/" * ENV["AZURE_OPENAI_DEPLOY_NAME_GPT_4O"]
53+
end
54+
55+
if haskey(ENV, "AZURE_OPENAI_DEPLOY_NAME_GPT_4O_MINI")
56+
d["gpt-4o-mini"] = "/openai/deployments/" * ENV["AZURE_OPENAI_DEPLOY_NAME_GPT_4O_MINI"]
57+
end
58+
59+
d
60+
end
61+
62+
function add_azure_deploy_name!(model::String, deploy_name::String)
63+
_MODEL_ENDPOINTS_AZURE_OPENAI[model] = "/openai/deployments/" * deploy_name
64+
end

test/api.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@
9393

9494
@testset "JSON_OBJECT" begin
9595
chat = UniLM.Chat(response_format=UniLM.json_object())
96-
push!(chat, UniLM.Message(role=UniLM.RoleSystem, content="Act as a helpful AI agent answering only in JSON."))
97-
push!(chat, UniLM.Message(role=UniLM.RoleUser, content="Please tell me a one-liner joke."))
96+
push!(chat, UniLM.Message(role=UniLM.RoleSystem, content="Act as a helpful AI agent."))
97+
push!(chat, UniLM.Message(role=UniLM.RoleUser, content="Please tell me a one-liner joke (return JSON format)."))
9898

9999
cr = UniLM.chatrequest!(chat)
100100

0 commit comments

Comments
 (0)