From 03473655e58ba1c27d0efb4db030f5ae951d6da3 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 17 Oct 2024 19:26:07 +0000
Subject: [PATCH 1/6] feat(api): api update (#1)
---
.release-please-manifest.json | 3 ++
CONTRIBUTING.md | 2 +-
README.md | 24 ++++++---
aliases.go | 2 +-
api.md | 8 +--
chat.go | 2 +-
chatcompletion.go | 8 +--
chatcompletion_test.go | 8 +--
client.go | 4 +-
client_test.go | 8 +--
completion.go | 8 +--
completion_test.go | 8 +--
field.go | 4 +-
go.mod | 2 +-
internal/apierror/apierror.go | 2 +-
internal/apiform/encoder.go | 2 +-
internal/apijson/encoder.go | 2 +-
internal/apijson/field_test.go | 2 +-
internal/apiquery/encoder.go | 2 +-
internal/requestconfig/requestconfig.go | 8 +--
internal/version.go | 2 +-
option/requestoption.go | 4 +-
release-please-config.json | 67 +++++++++++++++++++++++++
usage_test.go | 8 +--
24 files changed, 134 insertions(+), 56 deletions(-)
create mode 100644 .release-please-manifest.json
create mode 100644 release-please-config.json
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
new file mode 100644
index 0000000..c476280
--- /dev/null
+++ b/.release-please-manifest.json
@@ -0,0 +1,3 @@
+{
+ ".": "0.0.1-alpha.0"
+}
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 397f31f..77e5abf 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -41,7 +41,7 @@ To use a local version of this library from source in another project, edit the
directive. This can be done through the CLI with the following:
```sh
-$ go mod edit -replace github.com/stainless-sdks/omnistack-go=/path/to/omnistack-go
+$ go mod edit -replace github.com/OmniStack-sh/omnistack-go=/path/to/omnistack-go
```
## Running tests
diff --git a/README.md b/README.md
index 0720344..1b13f8e 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Omnistack Go API Library
-
+
The Omnistack Go library provides convenient access to [the Omnistack REST
API](https://docs.omnistack.sh) from applications written in Go. The full API of this library can be found in [api.md](api.md).
@@ -9,18 +9,26 @@ It is generated with [Stainless](https://www.stainlessapi.com/).
## Installation
+
+
```go
import (
- "github.com/stainless-sdks/omnistack-go" // imported as omnistack
+ "github.com/OmniStack-sh/omnistack-go" // imported as omnistack
)
```
+
+
Or to pin the version:
+
+
```sh
-go get -u 'github.com/stainless-sdks/omnistack-go@v0.0.1-alpha.0'
+go get -u 'github.com/OmniStack-sh/omnistack-go@v0.0.1-alpha.0'
```
+
+
## Requirements
This library requires Go 1.18+.
@@ -36,9 +44,9 @@ import (
"context"
"fmt"
- "github.com/stainless-sdks/omnistack-go"
- "github.com/stainless-sdks/omnistack-go/option"
- "github.com/stainless-sdks/omnistack-go/shared"
+ "github.com/OmniStack-sh/omnistack-go"
+ "github.com/OmniStack-sh/omnistack-go/option"
+ "github.com/OmniStack-sh/omnistack-go/shared"
)
func main() {
@@ -149,7 +157,7 @@ client.Completions.New(context.TODO(), ...,
)
```
-See the [full list of request options](https://pkg.go.dev/github.com/stainless-sdks/omnistack-go/option).
+See the [full list of request options](https://pkg.go.dev/github.com/OmniStack-sh/omnistack-go/option).
### Pagination
@@ -342,7 +350,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
-We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/omnistack-go/issues) with questions, bugs, or suggestions.
+We are keen for your feedback; please open an [issue](https://www.github.com/OmniStack-sh/omnistack-go/issues) with questions, bugs, or suggestions.
## Contributing
diff --git a/aliases.go b/aliases.go
index bb44a1c..9332ad2 100644
--- a/aliases.go
+++ b/aliases.go
@@ -3,7 +3,7 @@
package omnistack
import (
- "github.com/stainless-sdks/omnistack-go/internal/apierror"
+ "github.com/OmniStack-sh/omnistack-go/internal/apierror"
)
type Error = apierror.Error
diff --git a/api.md b/api.md
index e9c3518..1a5b4f8 100644
--- a/api.md
+++ b/api.md
@@ -4,18 +4,18 @@
Response Types:
-- omnistack.ChatCompletionNewResponse
+- omnistack.ChatCompletionNewResponse
Methods:
-- client.Chats.Completions.New(ctx context.Context, body omnistack.ChatCompletionNewParams) (omnistack.ChatCompletionNewResponse, error)
+- client.Chats.Completions.New(ctx context.Context, body omnistack.ChatCompletionNewParams) (omnistack.ChatCompletionNewResponse, error)
# Completions
Response Types:
-- omnistack.CompletionNewResponse
+- omnistack.CompletionNewResponse
Methods:
-- client.Completions.New(ctx context.Context, body omnistack.CompletionNewParams) (omnistack.CompletionNewResponse, error)
+- client.Completions.New(ctx context.Context, body omnistack.CompletionNewParams) (omnistack.CompletionNewResponse, error)
diff --git a/chat.go b/chat.go
index 0168bbc..a01d942 100644
--- a/chat.go
+++ b/chat.go
@@ -3,7 +3,7 @@
package omnistack
import (
- "github.com/stainless-sdks/omnistack-go/option"
+ "github.com/OmniStack-sh/omnistack-go/option"
)
// ChatService contains methods and other services that help with interacting with
diff --git a/chatcompletion.go b/chatcompletion.go
index d7680ad..812e231 100644
--- a/chatcompletion.go
+++ b/chatcompletion.go
@@ -6,10 +6,10 @@ import (
"context"
"net/http"
- "github.com/stainless-sdks/omnistack-go/internal/apijson"
- "github.com/stainless-sdks/omnistack-go/internal/param"
- "github.com/stainless-sdks/omnistack-go/internal/requestconfig"
- "github.com/stainless-sdks/omnistack-go/option"
+ "github.com/OmniStack-sh/omnistack-go/internal/apijson"
+ "github.com/OmniStack-sh/omnistack-go/internal/param"
+ "github.com/OmniStack-sh/omnistack-go/internal/requestconfig"
+ "github.com/OmniStack-sh/omnistack-go/option"
)
// ChatCompletionService contains methods and other services that help with
diff --git a/chatcompletion_test.go b/chatcompletion_test.go
index cbd5fd7..1037631 100644
--- a/chatcompletion_test.go
+++ b/chatcompletion_test.go
@@ -8,10 +8,10 @@ import (
"os"
"testing"
- "github.com/stainless-sdks/omnistack-go"
- "github.com/stainless-sdks/omnistack-go/internal/testutil"
- "github.com/stainless-sdks/omnistack-go/option"
- "github.com/stainless-sdks/omnistack-go/shared"
+ "github.com/OmniStack-sh/omnistack-go"
+ "github.com/OmniStack-sh/omnistack-go/internal/testutil"
+ "github.com/OmniStack-sh/omnistack-go/option"
+ "github.com/OmniStack-sh/omnistack-go/shared"
)
func TestChatCompletionNewWithOptionalParams(t *testing.T) {
diff --git a/client.go b/client.go
index 39e6ebe..2c7afc5 100644
--- a/client.go
+++ b/client.go
@@ -7,8 +7,8 @@ import (
"net/http"
"os"
- "github.com/stainless-sdks/omnistack-go/internal/requestconfig"
- "github.com/stainless-sdks/omnistack-go/option"
+ "github.com/OmniStack-sh/omnistack-go/internal/requestconfig"
+ "github.com/OmniStack-sh/omnistack-go/option"
)
// Client creates a struct with services and top level methods that help with
diff --git a/client_test.go b/client_test.go
index 9e002e9..cc38cae 100644
--- a/client_test.go
+++ b/client_test.go
@@ -10,10 +10,10 @@ import (
"testing"
"time"
- "github.com/stainless-sdks/omnistack-go"
- "github.com/stainless-sdks/omnistack-go/internal"
- "github.com/stainless-sdks/omnistack-go/option"
- "github.com/stainless-sdks/omnistack-go/shared"
+ "github.com/OmniStack-sh/omnistack-go"
+ "github.com/OmniStack-sh/omnistack-go/internal"
+ "github.com/OmniStack-sh/omnistack-go/option"
+ "github.com/OmniStack-sh/omnistack-go/shared"
)
type closureTransport struct {
diff --git a/completion.go b/completion.go
index ebbbd47..2d709db 100644
--- a/completion.go
+++ b/completion.go
@@ -6,10 +6,10 @@ import (
"context"
"net/http"
- "github.com/stainless-sdks/omnistack-go/internal/apijson"
- "github.com/stainless-sdks/omnistack-go/internal/param"
- "github.com/stainless-sdks/omnistack-go/internal/requestconfig"
- "github.com/stainless-sdks/omnistack-go/option"
+ "github.com/OmniStack-sh/omnistack-go/internal/apijson"
+ "github.com/OmniStack-sh/omnistack-go/internal/param"
+ "github.com/OmniStack-sh/omnistack-go/internal/requestconfig"
+ "github.com/OmniStack-sh/omnistack-go/option"
)
// CompletionService contains methods and other services that help with interacting
diff --git a/completion_test.go b/completion_test.go
index c6b1d98..0c5f9e3 100644
--- a/completion_test.go
+++ b/completion_test.go
@@ -8,10 +8,10 @@ import (
"os"
"testing"
- "github.com/stainless-sdks/omnistack-go"
- "github.com/stainless-sdks/omnistack-go/internal/testutil"
- "github.com/stainless-sdks/omnistack-go/option"
- "github.com/stainless-sdks/omnistack-go/shared"
+ "github.com/OmniStack-sh/omnistack-go"
+ "github.com/OmniStack-sh/omnistack-go/internal/testutil"
+ "github.com/OmniStack-sh/omnistack-go/option"
+ "github.com/OmniStack-sh/omnistack-go/shared"
)
func TestCompletionNewWithOptionalParams(t *testing.T) {
diff --git a/field.go b/field.go
index 2ef2b83..e88963e 100644
--- a/field.go
+++ b/field.go
@@ -1,7 +1,7 @@
package omnistack
import (
- "github.com/stainless-sdks/omnistack-go/internal/param"
+ "github.com/OmniStack-sh/omnistack-go/internal/param"
"io"
)
@@ -9,7 +9,7 @@ import (
// This helps specify null, zero values, and overrides, as well as normal values.
// You can read more about this in our [README].
//
-// [README]: https://pkg.go.dev/github.com/stainless-sdks/omnistack-go#readme-request-fields
+// [README]: https://pkg.go.dev/github.com/OmniStack-sh/omnistack-go#readme-request-fields
func F[T any](value T) param.Field[T] { return param.Field[T]{Value: value, Present: true} }
// Null is a param field helper which explicitly sends null to the API.
diff --git a/go.mod b/go.mod
index 61db829..46c5bea 100644
--- a/go.mod
+++ b/go.mod
@@ -1,4 +1,4 @@
-module github.com/stainless-sdks/omnistack-go
+module github.com/OmniStack-sh/omnistack-go
go 1.21
diff --git a/internal/apierror/apierror.go b/internal/apierror/apierror.go
index 087f90b..c759372 100644
--- a/internal/apierror/apierror.go
+++ b/internal/apierror/apierror.go
@@ -7,7 +7,7 @@ import (
"net/http"
"net/http/httputil"
- "github.com/stainless-sdks/omnistack-go/internal/apijson"
+ "github.com/OmniStack-sh/omnistack-go/internal/apijson"
)
// Error represents an error that originates from the API, i.e. when a request is
diff --git a/internal/apiform/encoder.go b/internal/apiform/encoder.go
index 7fffc2f..f8910a9 100644
--- a/internal/apiform/encoder.go
+++ b/internal/apiform/encoder.go
@@ -13,7 +13,7 @@ import (
"sync"
"time"
- "github.com/stainless-sdks/omnistack-go/internal/param"
+ "github.com/OmniStack-sh/omnistack-go/internal/param"
)
var encoders sync.Map // map[encoderEntry]encoderFunc
diff --git a/internal/apijson/encoder.go b/internal/apijson/encoder.go
index a250066..184c1ee 100644
--- a/internal/apijson/encoder.go
+++ b/internal/apijson/encoder.go
@@ -12,7 +12,7 @@ import (
"github.com/tidwall/sjson"
- "github.com/stainless-sdks/omnistack-go/internal/param"
+ "github.com/OmniStack-sh/omnistack-go/internal/param"
)
var encoders sync.Map // map[encoderEntry]encoderFunc
diff --git a/internal/apijson/field_test.go b/internal/apijson/field_test.go
index bbfecde..caed03b 100644
--- a/internal/apijson/field_test.go
+++ b/internal/apijson/field_test.go
@@ -4,7 +4,7 @@ import (
"testing"
"time"
- "github.com/stainless-sdks/omnistack-go/internal/param"
+ "github.com/OmniStack-sh/omnistack-go/internal/param"
)
type Struct struct {
diff --git a/internal/apiquery/encoder.go b/internal/apiquery/encoder.go
index 7946db2..6c1f8e0 100644
--- a/internal/apiquery/encoder.go
+++ b/internal/apiquery/encoder.go
@@ -9,7 +9,7 @@ import (
"sync"
"time"
- "github.com/stainless-sdks/omnistack-go/internal/param"
+ "github.com/OmniStack-sh/omnistack-go/internal/param"
)
var encoders sync.Map // map[reflect.Type]encoderFunc
diff --git a/internal/requestconfig/requestconfig.go b/internal/requestconfig/requestconfig.go
index 1a9e7a0..f71c994 100644
--- a/internal/requestconfig/requestconfig.go
+++ b/internal/requestconfig/requestconfig.go
@@ -17,10 +17,10 @@ import (
"strings"
"time"
- "github.com/stainless-sdks/omnistack-go/internal"
- "github.com/stainless-sdks/omnistack-go/internal/apierror"
- "github.com/stainless-sdks/omnistack-go/internal/apiform"
- "github.com/stainless-sdks/omnistack-go/internal/apiquery"
+ "github.com/OmniStack-sh/omnistack-go/internal"
+ "github.com/OmniStack-sh/omnistack-go/internal/apierror"
+ "github.com/OmniStack-sh/omnistack-go/internal/apiform"
+ "github.com/OmniStack-sh/omnistack-go/internal/apiquery"
)
func getDefaultHeaders() map[string]string {
diff --git a/internal/version.go b/internal/version.go
index 1e49ee4..4ff68e4 100644
--- a/internal/version.go
+++ b/internal/version.go
@@ -2,4 +2,4 @@
package internal
-const PackageVersion = "0.0.1-alpha.0"
+const PackageVersion = "0.0.1-alpha.0" // x-release-please-version
diff --git a/option/requestoption.go b/option/requestoption.go
index 5e9e172..c2ec142 100644
--- a/option/requestoption.go
+++ b/option/requestoption.go
@@ -11,7 +11,7 @@ import (
"net/url"
"time"
- "github.com/stainless-sdks/omnistack-go/internal/requestconfig"
+ "github.com/OmniStack-sh/omnistack-go/internal/requestconfig"
"github.com/tidwall/sjson"
)
@@ -19,7 +19,7 @@ import (
// which can be supplied to clients, services, and methods. You can read more about this functional
// options pattern in our [README].
//
-// [README]: https://pkg.go.dev/github.com/stainless-sdks/omnistack-go#readme-requestoptions
+// [README]: https://pkg.go.dev/github.com/OmniStack-sh/omnistack-go#readme-requestoptions
type RequestOption = func(*requestconfig.RequestConfig) error
// WithBaseURL returns a RequestOption that sets the BaseURL for the client.
diff --git a/release-please-config.json b/release-please-config.json
new file mode 100644
index 0000000..a38198e
--- /dev/null
+++ b/release-please-config.json
@@ -0,0 +1,67 @@
+{
+ "packages": {
+ ".": {}
+ },
+ "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json",
+ "include-v-in-tag": true,
+ "include-component-in-tag": false,
+ "versioning": "prerelease",
+ "prerelease": true,
+ "bump-minor-pre-major": true,
+ "bump-patch-for-minor-pre-major": false,
+ "pull-request-header": "Automated Release PR",
+ "pull-request-title-pattern": "release: ${version}",
+ "changelog-sections": [
+ {
+ "type": "feat",
+ "section": "Features"
+ },
+ {
+ "type": "fix",
+ "section": "Bug Fixes"
+ },
+ {
+ "type": "perf",
+ "section": "Performance Improvements"
+ },
+ {
+ "type": "revert",
+ "section": "Reverts"
+ },
+ {
+ "type": "chore",
+ "section": "Chores"
+ },
+ {
+ "type": "docs",
+ "section": "Documentation"
+ },
+ {
+ "type": "style",
+ "section": "Styles"
+ },
+ {
+ "type": "refactor",
+ "section": "Refactors"
+ },
+ {
+ "type": "test",
+ "section": "Tests",
+ "hidden": true
+ },
+ {
+ "type": "build",
+ "section": "Build System"
+ },
+ {
+ "type": "ci",
+ "section": "Continuous Integration",
+ "hidden": true
+ }
+ ],
+ "release-type": "go",
+ "extra-files": [
+ "internal/version.go",
+ "README.md"
+ ]
+}
\ No newline at end of file
diff --git a/usage_test.go b/usage_test.go
index fb4735e..52f2b63 100644
--- a/usage_test.go
+++ b/usage_test.go
@@ -7,10 +7,10 @@ import (
"os"
"testing"
- "github.com/stainless-sdks/omnistack-go"
- "github.com/stainless-sdks/omnistack-go/internal/testutil"
- "github.com/stainless-sdks/omnistack-go/option"
- "github.com/stainless-sdks/omnistack-go/shared"
+ "github.com/OmniStack-sh/omnistack-go"
+ "github.com/OmniStack-sh/omnistack-go/internal/testutil"
+ "github.com/OmniStack-sh/omnistack-go/option"
+ "github.com/OmniStack-sh/omnistack-go/shared"
)
func TestUsage(t *testing.T) {
From 03109368086e46dd404cb71f46609cfd9fa82c28 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Wed, 6 Nov 2024 00:50:18 +0000
Subject: [PATCH 2/6] chore: rebuild project due to codegen change (#3)
---
chatcompletion.go | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/chatcompletion.go b/chatcompletion.go
index 812e231..ea00009 100644
--- a/chatcompletion.go
+++ b/chatcompletion.go
@@ -718,16 +718,16 @@ func (r ChatCompletionNewParams) MarshalJSON() (data []byte, err error) {
}
type ChatCompletionNewParamsMessage struct {
- Content param.Field[interface{}] `json:"content,required"`
+ Content param.Field[interface{}] `json:"content,required"`
+ FunctionCall param.Field[interface{}] `json:"function_call,required"`
// The role of the messages author, in this case `system`.
- Role param.Field[ChatCompletionNewParamsMessagesRole] `json:"role,required"`
+ Role param.Field[ChatCompletionNewParamsMessagesRole] `json:"role,required"`
+ ToolCalls param.Field[interface{}] `json:"tool_calls,required"`
// An optional name for the participant. Provides the model information to
// differentiate between participants of the same role.
Name param.Field[string] `json:"name"`
// The refusal message by the assistant.
- Refusal param.Field[string] `json:"refusal"`
- ToolCalls param.Field[interface{}] `json:"tool_calls,required"`
- FunctionCall param.Field[interface{}] `json:"function_call,required"`
+ Refusal param.Field[string] `json:"refusal"`
// Tool call that this message is responding to.
ToolCallID param.Field[string] `json:"tool_call_id"`
}
@@ -851,11 +851,11 @@ func (r ChatCompletionNewParamsMessagesChatCompletionRequestUserMessageContentAr
}
type ChatCompletionNewParamsMessagesChatCompletionRequestUserMessageContentArrayOfContentPart struct {
+ ImageURL param.Field[interface{}] `json:"image_url,required"`
// The type of the content part.
Type param.Field[ChatCompletionNewParamsMessagesChatCompletionRequestUserMessageContentArrayOfContentPartsType] `json:"type,required"`
// The text content.
- Text param.Field[string] `json:"text"`
- ImageURL param.Field[interface{}] `json:"image_url,required"`
+ Text param.Field[string] `json:"text"`
}
func (r ChatCompletionNewParamsMessagesChatCompletionRequestUserMessageContentArrayOfContentPart) MarshalJSON() (data []byte, err error) {
@@ -1048,10 +1048,10 @@ func (r ChatCompletionNewParamsMessagesChatCompletionRequestAssistantMessageCont
type ChatCompletionNewParamsMessagesChatCompletionRequestAssistantMessageContentArrayOfContentPart struct {
// The type of the content part.
Type param.Field[ChatCompletionNewParamsMessagesChatCompletionRequestAssistantMessageContentArrayOfContentPartsType] `json:"type,required"`
- // The text content.
- Text param.Field[string] `json:"text"`
// The refusal message generated by the model.
Refusal param.Field[string] `json:"refusal"`
+ // The text content.
+ Text param.Field[string] `json:"text"`
}
func (r ChatCompletionNewParamsMessagesChatCompletionRequestAssistantMessageContentArrayOfContentPart) MarshalJSON() (data []byte, err error) {
@@ -1456,9 +1456,9 @@ func (r ChatCompletionNewParamsFunction) MarshalJSON() (data []byte, err error)
// indicates the generation exceeded `max_tokens` or the conversation exceeded the
// max context length.
type ChatCompletionNewParamsResponseFormat struct {
+ JsonSchema param.Field[interface{}] `json:"json_schema,required"`
// The type of response format being defined: `text`
- Type param.Field[ChatCompletionNewParamsResponseFormatType] `json:"type,required"`
- JsonSchema param.Field[interface{}] `json:"json_schema,required"`
+ Type param.Field[ChatCompletionNewParamsResponseFormatType] `json:"type,required"`
}
func (r ChatCompletionNewParamsResponseFormat) MarshalJSON() (data []byte, err error) {
From fff822929b7eaebef5ad640aa1ce4d101306b1d9 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 7 Nov 2024 19:06:20 +0000
Subject: [PATCH 3/6] chore: rebuild project due to codegen change (#4)
---
chatcompletion.go | 3 +++
completion.go | 4 ++++
2 files changed, 7 insertions(+)
diff --git a/chatcompletion.go b/chatcompletion.go
index ea00009..f67f0cc 100644
--- a/chatcompletion.go
+++ b/chatcompletion.go
@@ -1322,6 +1322,9 @@ func (r ChatCompletionNewParamsMessagesRole) IsKnown() bool {
return false
}
+// ID of the model to use. See the
+// [model endpoint compatibility](/docs/models/model-endpoint-compatibility) table
+// for details on which models work with the Chat API.
type ChatCompletionNewParamsModel string
const (
diff --git a/completion.go b/completion.go
index 2d709db..bddfecd 100644
--- a/completion.go
+++ b/completion.go
@@ -347,6 +347,10 @@ func (r CompletionNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
+// ID of the model to use. You can use the
+// [List models](/docs/api-reference/models/list) API to see all of your available
+// models, or see our [Model overview](/docs/models/overview) for descriptions of
+// them.
type CompletionNewParamsModel string
const (
From 56b183ee2acaff05db03c7e6ff6630239ad6a708 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 8 Nov 2024 17:41:33 +0000
Subject: [PATCH 4/6] chore: rebuild project due to codegen change (#5)
---
internal/apijson/encoder.go | 13 ++++++++++---
internal/apijson/json_test.go | 5 +++--
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/internal/apijson/encoder.go b/internal/apijson/encoder.go
index 184c1ee..9bc3873 100644
--- a/internal/apijson/encoder.go
+++ b/internal/apijson/encoder.go
@@ -7,6 +7,7 @@ import (
"reflect"
"sort"
"strconv"
+ "strings"
"sync"
"time"
@@ -342,16 +343,18 @@ func (e *encoder) encodeMapEntries(json []byte, v reflect.Value) ([]byte, error)
iter := v.MapRange()
for iter.Next() {
- var encodedKey []byte
+ var encodedKeyString string
if iter.Key().Type().Kind() == reflect.String {
- encodedKey = []byte(iter.Key().String())
+ encodedKeyString = iter.Key().String()
} else {
var err error
- encodedKey, err = keyEncoder(iter.Key())
+ encodedKeyBytes, err := keyEncoder(iter.Key())
if err != nil {
return nil, err
}
+ encodedKeyString = string(encodedKeyBytes)
}
+ encodedKey := []byte(sjsonReplacer.Replace(encodedKeyString))
pairs = append(pairs, mapPair{key: encodedKey, value: iter.Value()})
}
@@ -389,3 +392,7 @@ func (e *encoder) newMapEncoder(t reflect.Type) encoderFunc {
return json, nil
}
}
+
+// If we want to set a literal key value into JSON using sjson, we need to make sure it doesn't have
+// special characters that sjson interprets as a path.
+var sjsonReplacer *strings.Replacer = strings.NewReplacer(".", "\\.", ":", "\\:", "*", "\\*")
diff --git a/internal/apijson/json_test.go b/internal/apijson/json_test.go
index 85cd2b5..e656344 100644
--- a/internal/apijson/json_test.go
+++ b/internal/apijson/json_test.go
@@ -361,8 +361,9 @@ var tests = map[string]struct {
"date_time_missing_timezone_colon_coerce": {`"2007-03-01T13:03:05-1200"`, time.Date(2007, time.March, 1, 13, 3, 5, 0, time.FixedZone("", -12*60*60))},
"date_time_nano_missing_t_coerce": {`"2007-03-01 13:03:05.123456789Z"`, time.Date(2007, time.March, 1, 13, 3, 5, 123456789, time.UTC)},
- "map_string": {`{"foo":"bar"}`, map[string]string{"foo": "bar"}},
- "map_interface": {`{"a":1,"b":"str","c":false}`, map[string]interface{}{"a": float64(1), "b": "str", "c": false}},
+ "map_string": {`{"foo":"bar"}`, map[string]string{"foo": "bar"}},
+ "map_string_with_sjson_path_chars": {`{":a.b.c*:d*-1e.f":"bar"}`, map[string]string{":a.b.c*:d*-1e.f": "bar"}},
+ "map_interface": {`{"a":1,"b":"str","c":false}`, map[string]interface{}{"a": float64(1), "b": "str", "c": false}},
"primitive_struct": {
`{"a":false,"b":237628372683,"c":654,"d":9999.43,"e":43.76,"f":[1,2,3,4]}`,
From 739c7587e513861525a3df88f0da234df86fa518 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 12 Nov 2024 04:35:35 +0000
Subject: [PATCH 5/6] chore: rebuild project due to codegen change (#6)
---
chatcompletion.go | 18 +++++++++---------
internal/requestconfig/requestconfig.go | 4 ++++
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/chatcompletion.go b/chatcompletion.go
index f67f0cc..5036fc5 100644
--- a/chatcompletion.go
+++ b/chatcompletion.go
@@ -718,18 +718,18 @@ func (r ChatCompletionNewParams) MarshalJSON() (data []byte, err error) {
}
type ChatCompletionNewParamsMessage struct {
- Content param.Field[interface{}] `json:"content,required"`
- FunctionCall param.Field[interface{}] `json:"function_call,required"`
// The role of the messages author, in this case `system`.
- Role param.Field[ChatCompletionNewParamsMessagesRole] `json:"role,required"`
- ToolCalls param.Field[interface{}] `json:"tool_calls,required"`
+ Role param.Field[ChatCompletionNewParamsMessagesRole] `json:"role,required"`
+ Content param.Field[interface{}] `json:"content"`
+ FunctionCall param.Field[interface{}] `json:"function_call"`
// An optional name for the participant. Provides the model information to
// differentiate between participants of the same role.
Name param.Field[string] `json:"name"`
// The refusal message by the assistant.
Refusal param.Field[string] `json:"refusal"`
// Tool call that this message is responding to.
- ToolCallID param.Field[string] `json:"tool_call_id"`
+ ToolCallID param.Field[string] `json:"tool_call_id"`
+ ToolCalls param.Field[interface{}] `json:"tool_calls"`
}
func (r ChatCompletionNewParamsMessage) MarshalJSON() (data []byte, err error) {
@@ -851,9 +851,9 @@ func (r ChatCompletionNewParamsMessagesChatCompletionRequestUserMessageContentAr
}
type ChatCompletionNewParamsMessagesChatCompletionRequestUserMessageContentArrayOfContentPart struct {
- ImageURL param.Field[interface{}] `json:"image_url,required"`
// The type of the content part.
- Type param.Field[ChatCompletionNewParamsMessagesChatCompletionRequestUserMessageContentArrayOfContentPartsType] `json:"type,required"`
+ Type param.Field[ChatCompletionNewParamsMessagesChatCompletionRequestUserMessageContentArrayOfContentPartsType] `json:"type,required"`
+ ImageURL param.Field[interface{}] `json:"image_url"`
// The text content.
Text param.Field[string] `json:"text"`
}
@@ -1459,9 +1459,9 @@ func (r ChatCompletionNewParamsFunction) MarshalJSON() (data []byte, err error)
// indicates the generation exceeded `max_tokens` or the conversation exceeded the
// max context length.
type ChatCompletionNewParamsResponseFormat struct {
- JsonSchema param.Field[interface{}] `json:"json_schema,required"`
// The type of response format being defined: `text`
- Type param.Field[ChatCompletionNewParamsResponseFormatType] `json:"type,required"`
+ Type param.Field[ChatCompletionNewParamsResponseFormatType] `json:"type,required"`
+ JsonSchema param.Field[interface{}] `json:"json_schema"`
}
func (r ChatCompletionNewParamsResponseFormat) MarshalJSON() (data []byte, err error) {
diff --git a/internal/requestconfig/requestconfig.go b/internal/requestconfig/requestconfig.go
index f71c994..8724fd6 100644
--- a/internal/requestconfig/requestconfig.go
+++ b/internal/requestconfig/requestconfig.go
@@ -299,6 +299,10 @@ func retryDelay(res *http.Response, retryCount int) time.Duration {
}
func (cfg *RequestConfig) Execute() (err error) {
+ if cfg.BaseURL == nil {
+ return fmt.Errorf("requestconfig: base url is not set")
+ }
+
cfg.Request.URL, err = cfg.BaseURL.Parse(strings.TrimLeft(cfg.Request.URL.String(), "/"))
if err != nil {
return err
From 4169763b6aac3b49d4fea05db04bc8f1daa89f76 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 12 Nov 2024 04:36:00 +0000
Subject: [PATCH 6/6] release: 0.1.0-alpha.1
---
.release-please-manifest.json | 2 +-
CHANGELOG.md | 18 ++++++++++++++++++
README.md | 2 +-
internal/version.go | 2 +-
4 files changed, 21 insertions(+), 3 deletions(-)
create mode 100644 CHANGELOG.md
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index c476280..ba6c348 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.0.1-alpha.0"
+ ".": "0.1.0-alpha.1"
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..3d65bf8
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,18 @@
+# Changelog
+
+## 0.1.0-alpha.1 (2024-11-12)
+
+Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/OmniStack-sh/omnistack-go/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
+
+### Features
+
+* **api:** api update ([22684a0](https://github.com/OmniStack-sh/omnistack-go/commit/22684a032772fb089956907ea762bcda2dedc4aa))
+* **api:** api update ([#1](https://github.com/OmniStack-sh/omnistack-go/issues/1)) ([0347365](https://github.com/OmniStack-sh/omnistack-go/commit/03473655e58ba1c27d0efb4db030f5ae951d6da3))
+
+
+### Chores
+
+* rebuild project due to codegen change ([#3](https://github.com/OmniStack-sh/omnistack-go/issues/3)) ([0310936](https://github.com/OmniStack-sh/omnistack-go/commit/03109368086e46dd404cb71f46609cfd9fa82c28))
+* rebuild project due to codegen change ([#4](https://github.com/OmniStack-sh/omnistack-go/issues/4)) ([fff8229](https://github.com/OmniStack-sh/omnistack-go/commit/fff822929b7eaebef5ad640aa1ce4d101306b1d9))
+* rebuild project due to codegen change ([#5](https://github.com/OmniStack-sh/omnistack-go/issues/5)) ([56b183e](https://github.com/OmniStack-sh/omnistack-go/commit/56b183ee2acaff05db03c7e6ff6630239ad6a708))
+* rebuild project due to codegen change ([#6](https://github.com/OmniStack-sh/omnistack-go/issues/6)) ([739c758](https://github.com/OmniStack-sh/omnistack-go/commit/739c7587e513861525a3df88f0da234df86fa518))
diff --git a/README.md b/README.md
index 1b13f8e..e25e2b5 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,7 @@ Or to pin the version:
```sh
-go get -u 'github.com/OmniStack-sh/omnistack-go@v0.0.1-alpha.0'
+go get -u 'github.com/OmniStack-sh/omnistack-go@v0.1.0-alpha.1'
```
diff --git a/internal/version.go b/internal/version.go
index 4ff68e4..5ed22d7 100644
--- a/internal/version.go
+++ b/internal/version.go
@@ -2,4 +2,4 @@
package internal
-const PackageVersion = "0.0.1-alpha.0" // x-release-please-version
+const PackageVersion = "0.1.0-alpha.1" // x-release-please-version