Skip to content

Commit

Permalink
Fixed issue #41
Browse files Browse the repository at this point in the history
  • Loading branch information
wkok committed Nov 19, 2023
1 parent 33ef132 commit 395de03
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
8 changes: 8 additions & 0 deletions resources/openapi-README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,21 @@ Some changes are required in the hosted YAML spec to make it compatible with Mar
* to: `16384`

## ChatCompletionFunctions/properties/parameters

later: (#/components/schemas/FunctionParameters)

More info in this [PR](https://github.com/wkok/openai-clojure/pull/23#issuecomment-1595764611)

* from: `ChatCompletionFunctionParameters`
* to: `{}`

## FunctionObject

More info in this [issue](https://github.com/wkok/openai-clojure/issues/41)

* from "#/components/schemas/FunctionParameters"
* to {}

## /threads/{thread_id}/runs/{run_id}/submit_tool_outputs

Fix the typo: [PR](https://github.com/openai/openai-openapi/pull/114)
Expand Down
3 changes: 1 addition & 2 deletions resources/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5783,8 +5783,7 @@ components:
name:
type: string
description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
parameters:
$ref: "#/components/schemas/FunctionParameters"
parameters: {}
required:
- name
- parameters
Expand Down
21 changes: 21 additions & 0 deletions test/wkok/openai_clojure/api_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,27 @@
(is (= :success
(api/create-thread-and-run {:assistant_id "----id----"}))))))

(deftest create-chat-completion-tools

(with-stubbed-martians

#(testing "Spec override for tools parameter. See https://github.com/wkok/openai-clojure/issues/41"

(is (= :success
(api/create-chat-completion {:model "gpt-3.5-turbo"
:messages [{:role "user"
:content "Wikipedia page about foxes"}]
:tools
[{:type "function"
:function {:name "get_current_weather"
:description "Get the current weather in a given location"
:parameters
{:type "object"
:properties {:location {:type "string"
:description "The city and state, e.g. San Francisco, CA"}
:unit {:type "string"
:enum ["celsius" "fahrenheit"]}}}}}]
:tool_choice "auto"}))))))

(deftest stream-test

Expand Down

0 comments on commit 395de03

Please sign in to comment.