File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -86,13 +86,21 @@ def conn(multipart: false)
8686
8787 def uri ( path :)
8888 if azure?
89- base = File . join ( @uri_base , path )
90- "#{ base } ?api-version=#{ @api_version } "
89+ azure_uri ( path )
9190 else
9291 File . join ( @uri_base , @api_version , path )
9392 end
9493 end
9594
95+ def azure_uri ( path :)
96+ base = File . join ( @uri_base , path )
97+
98+ # Remove the deployment to support assistants for azure
99+ base = base . gsub ( /\/ deployments\/ .+\/ / , '/' ) if ( path . include? ( '/assistants' ) || path . include? ( '/threads' ) )
100+
101+ "#{ base } ?api-version=#{ @api_version } "
102+ end
103+
96104 def multipart_parameters ( parameters )
97105 parameters &.transform_values do |value |
98106 next value unless value . respond_to? ( :close ) # File or IO object.
Original file line number Diff line number Diff line change 239239 let ( :uri_base ) { "https://custom-domain.openai.azure.com/openai/deployments/gpt-35-turbo" }
240240 it { expect ( uri ) . to eq ( "https://custom-domain.openai.azure.com/openai/deployments/gpt-35-turbo/chat?api-version=v1" ) }
241241 end
242+
243+ context "with assistants" do
244+ let ( :path ) { "/assistants" }
245+ let ( :uri_base ) { "https://custom-domain.openai.azure.com/openai/deployments/gpt-35-turbo" }
246+ it { expect ( uri ) . to eq ( "https://custom-domain.openai.azure.com/openai/assistants?api-version=v1" ) }
247+ end
242248 end
243249 end
244250
You can’t perform that action at this time.
0 commit comments