Commit Graph
372 Commits
Author SHA1 Message Date
Qiying Wang 2646bce71c feat: get header from sendRequestRaw (#694)
* feat: get header from sendRequestRaw

* Fix ci lint
2024-04-05 23:15:54 +04:00
Quest Henkart 0925563e86 Fix broken implementation AssistantModify implementation (#685)
* add custom marshaller, documentation and isolate tests

* fix linter
2024-03-15 14:59:16 +04:00
sunshineplan 699f397c36 Update streamReader Close() method to return error (#681) 2024-03-11 11:27:48 +04:00
Bilal Hameed 38b16a3c41 Added 'wav' and 'pcm' Audio Formats (#671)
* Added 'wav' and 'pcm' Audio Formats

Added "wav" and "pcm" audio formats as per OpenAI API documentation for createSpeech endpoint. 
Ref: https://platform.openai.com/docs/api-reference/audio/createSpeech
Supported formats are mp3, opus, aac, flac, wav, and pcm.

* Removed Extra Newline for Sanity Check

* fix: run goimports to get accepted by the linter
2024-03-07 14:56:50 +04:00
Martin Heck bb6149f64f fix: repair json decoding of moderation response (#670) 2024-02-28 13:25:47 +04:00
Guillaume Dussault 41037783bc fix: when no Assistant Tools are specified, an empty list should be sent (#669) 2024-02-26 12:48:53 +04:00
Raphaël Oester f220443985 Added fields for moderation (#662) 2024-02-26 12:48:09 +04:00
Rich Coggins c5401e9e64 Fix for broken Azure Threads url (#668) 2024-02-26 12:46:35 +04:00
Rich Coggins 7381d18a75 Fix for broken Azure Assistants url (#665)
* fix:fix url for Azure assistants api

* test:add unit tests for Azure Assistants api

* fix:minor liniting issue
2024-02-21 16:45:15 +04:00
CaoPengFlyingandcaopengfei1 e8b347891b fix:fix open ai original validation. modify Tool's Function to pointer (#664)
Co-authored-by: caopengfei1 <caopengfei1@tal.com>
2024-02-19 16:26:04 +04:00
Igor Berlenko 69e3bbb1eb Update client.go - allow to skip Authorization header (#658)
* Update client.go - allow to skip Authorization header

* Update client.go
2024-02-16 14:22:38 +04:00
chrbsg ff61bbb322 Add RunRequest field AdditionalInstructions (#656)
AdditionalInstructions is an optional string field used to append
additional instructions at the end of the instructions for the run. This
is useful for modifying the behavior on a per-run basis without
overriding other instructions.

Also, change the Model and Instructions *string fields to string.
2024-02-15 20:12:22 +04:00
66bae3ee73 Content-type fix (#659)
* charset fixes

* make linter happy (#661)

---------

Co-authored-by: grulex <god@vk.com>
Co-authored-by: Alexander Baranov <677093+sashabaranov@users.noreply.github.com>
2024-02-15 20:11:58 +04:00
Alexander Baranov 11ad4b69d0 make linter happy (#661) 2024-02-15 16:02:48 +04:00
shadowpigyandshadowpigy a7954c854c Feat: Add assistant usage (#649)
* Feat: Add assistant usage

---------

Co-authored-by: shadowpigy <shadowpigy@github.com>
2024-02-08 17:08:30 +04:00
xuanming.zhang 6c2e3162df Added support for CreateSpeech Azure models (#657) 2024-02-08 11:40:39 +04:00
chrbsg 69e3fcbc27 Fix typo assitantInstructions (#655) 2024-02-06 23:04:40 +04:00
shadowpigyandshadowpigy bb6ed54530 Fix: Add RunStatusCancelled (#650)
Co-authored-by: shadowpigy <shadowpigy@github.com>
2024-02-02 16:41:39 +04:00
Liu Shuang bc8cdd33d1 add GPT3Dot5Turbo0125 model (#648) 2024-02-02 14:30:24 +04:00
chenhhA 06ff541559 Add new struct filed dimensions for embedding API (#645)
* add new struct filed dimensions for embedding API

* docs: remove long single-line comments

* change embedding request param Dimensions type to int
2024-01-29 11:09:56 +04:00
Daniil 4c41f24a99 Support January 25, 2024, models update. (#644) 2024-01-26 12:41:48 +04:00
Qiying Wang eff8dc1118 fix(audio): fix audioTextResponse decode (#638)
* fix(audio): fix audioTextResponse decode

* test(audio): add audioTextResponse decode test

* test(audio): simplify code
2024-01-17 21:42:07 +04:00
Grey Baker 4ce03a919a Fix Azure embeddings model detection by passing string to fullURL (#637) 2024-01-16 13:32:48 +04:00
韩宏敏andHanHongmin 09f6920ad0 fixed #594 (#609)
APITypeAzure dall-e3 model url

Co-authored-by: HanHongmin <hanhongmin@inmyshow.com>
2024-01-15 16:01:49 +04:00
Matthew Jaffee e01a2d7231 convert EmbeddingModel to string type (#629)
This gives the user the ability to pass in models for embeddings that are not
already defined in the library. Also more closely matches how the completions
API works.
2024-01-15 13:33:02 +04:00
Alexander Kledal 682b7adb0b Update README.md (#631)
Ensure variables in examples are valid
2024-01-11 14:45:15 +04:00
Danai Antoniou f10955ce09 Log probabilities for chat completion output tokens (#625)
* Add logprobs

* Logprobs pointer

* Move toplogporbs

* Create toplogprobs struct

* Remove pointers
2024-01-09 20:50:56 +04:00
xuanming.zhang c9615e0cbe Added support for createImage Azure models (#608) 2024-01-03 17:42:57 +06:00
mikeb26 a09cb0c528 Add completion-with-tool example (#598)
As a user of this go SDK it was not immediately intuitive to me how to
correctly utilize the function calling capability of GPT4
(https://platform.openai.com/docs/guides/function-calling). While the
aformentioned link provides a helpful example written in python, I
initially tripped over how to correclty translate the specification of
function arguments when usingthis go SDK.

To make it easier for others in the future this commit adds a
completion-with-tool example showing how to correctly utilize the
function calling capability of GPT4 using this SDK end-to-end in a
CreateChatCompletion() sequence.
2023-11-26 12:45:28 +04:00
Radosław Kintzi 03caea89b7 Add support for multi part chat messages (and gpt-4-vision-preview model) (#580)
* Add support for multi part chat messages

OpenAI has recently introduced a new model called gpt-4-visual-preview,
which now supports images as input. The chat completion endpoint accepts
multi-part chat messages, where the content can be an array of structs
in addition to the usual string format.

This commit introduces new structures and constants to represent
different types of content parts. It also implements the json.Marshaler
and json.Unmarshaler interfaces on ChatCompletionMessage.

* Add ImageURLDetail and ChatMessagePartType types

* Optimize ChatCompletionMessage deserialization

* Add ErrContentFieldsMisused error
2023-11-24 17:17:00 +04:00
Alexander Baranov 7260991327 Update PULL_REQUEST_TEMPLATE.md (#606) 2023-11-24 13:36:10 +04:00
pjuhaszandPeter Juhasz f87909596f Add canary-tts to speech models (#603)
Co-authored-by: Peter Juhasz <juhasz.peter@uhusystems.com>
2023-11-24 11:34:25 +04:00
Albert Putra Purnama a130cfee26 Add missing response fields for pagination (#584) 2023-11-18 11:01:06 +04:00
Albert Putra Purnama 9efad284d0 Updates the tool call struct (#595) 2023-11-18 10:59:01 +04:00
Charlie Revett 4fd904c292 Add File purposes as constants (#577)
* Add purposes.

* Formatting.
2023-11-18 10:55:58 +04:00
Charlie Revett 18465723f7 Add missing struct properties. (#579) 2023-11-15 20:25:18 +04:00
Ccheers 3220f19ee2 feat(runapi): add RunStepList response args https://platform.openai.com/docs/api-reference/runs/listRunSteps (#573) 2023-11-15 20:23:41 +04:00
Liron Levin 464b85b6d7 Pagination fields are missing from assistants list beta API (#571)
curl "https://api.openai.com/v1/assistants?order=desc&limit=20" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Beta: assistants=v1"
{
  "object": "list",
  "data": [],
  "first_id": null,
  "last_id": null,
  "has_more": false
}
2023-11-15 20:22:39 +04:00
Donnie Flood 71848ccf69 feat: support direct bytes for file upload (#568)
* feat: support direct bytes for file upload

* add test for errors

* add coverage
2023-11-15 20:08:48 +04:00
Donnie Flood fe67abb97e fix: add beta assistant header to CreateMessage call (#566) 2023-11-15 20:06:57 +04:00
Chris HuaandLachlan Laycock 515de0219d feat: initial TTS support (#528)
* feat: initial TTS support

* chore: lint, omitempty

* chore: dont use pointer in struct

* fix: add mocked server tests to speech_test.go

Co-authored-by: Lachlan Laycock <supagroova@gmail.com>

* chore: update imports

* chore: fix lint

* chore: add an error check

* chore: ignore lint

* chore: add error checks in package

* chore: add test

* chore: fix test

---------

Co-authored-by: Lachlan Laycock <supagroova@gmail.com>
2023-11-13 18:35:34 +04:00
Urjit Singh BhatiaandSimone Vellei b7cac703ac Feat/messages api (#546)
* fix test server setup:
- go map access is not deterministic
- this can lead to a route: /foo/bar/1 matching /foo/bar before matching /foo/bar/1 if the map iteration go through /foo/bar first since the regex match wasn't bound to start and end anchors
- registering handlers now converts * in routes to .* for proper regex matching
- test server route handling now tries to fully match the handler route

* add missing /v1 prefix to fine-tuning job cancel test server handler

* add create message call

* add messages list call

* add get message call

* add modify message call, fix return types for other message calls

* add message file retrieve call

* add list message files call

* code style fixes

* add test for list messages with pagination options

* add beta header to msg calls now that #545 is merged

* Update messages.go

Co-authored-by: Simone Vellei <henomis@gmail.com>

* Update messages.go

Co-authored-by: Simone Vellei <henomis@gmail.com>

* add missing object details for message, fix tests

* fix merge formatting

* minor style fixes

---------

Co-authored-by: Simone Vellei <henomis@gmail.com>
2023-11-13 18:33:26 +04:00
Ikko Eltociear Ashimine 9fefd50e12 Fix typo in chat_test.go (#564)
requetsts -> requests
2023-11-12 15:10:00 +04:00
Kyle Bolton 35495ccd36 Add json:"metadata,omitempty" to RunRequest struct (#561)
Metadata is an optional field per the api spec
https://platform.openai.com/docs/api-reference/runs/createRun
2023-11-12 15:09:40 +04:00
Simone Vellei d6f3bdcdac Feat implement Run APIs (#560)
* chore: first commit

* add apis

* chore: add tests

* feat add apis

* chore: add api and tests

* chore: add tests

* fix

* trigger build

* fix

* chore: formatting code

* chore: add pagination type
2023-11-09 23:17:30 +04:00
Simone Vellei 78862a2798 fix: add missing fields in tool_calls (#558) 2023-11-09 18:05:03 +04:00
Urjit Singh Bhatia 8127072553 fix test server setup: (#549)
* fix test server setup:
- go map access is not deterministic
- this can lead to a route: /foo/bar/1 matching /foo/bar before matching /foo/bar/1 if the map iteration go through /foo/bar first since the regex match wasn't bound to start and end anchors
- registering handlers now converts * in routes to .* for proper regex matching
- test server route handling now tries to fully match the handler route

* add missing /v1 prefix to fine-tuning job cancel test server handler
2023-11-09 12:20:39 +04:00
Gabriel Burt e3e065deb0 Add SystemFingerprint and chatMsg.ToolCallID field (#543)
* fix ToolChoiche typo

* add tool_call_id to ChatCompletionMessage

* add /chat system_fingerprint response field

* check empty ToolCallID JSON marshaling

and add omitempty for tool_call_id

* messages also required; don't omitempty

* add Type to ToolCall, required by the API

* fix test, omitempty for response_format ptr

* fix casing of role values in comments
2023-11-09 12:08:43 +04:00
Simone Vellei bc89139c1d Feat Implement threads API (#536)
* feat: implement threads API

* fix

* add tests

* fix

* trigger£

* trigger

* chore: add beta header
2023-11-09 12:05:44 +04:00
渡邉祐一 / Yuichi Watanabe 08c167fecf test: fix compile error in api integration test (#548) 2023-11-08 13:21:51 +04:00