Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#1919)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed May 7, 2024
1 parent d2945a8 commit ce25fff
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
@@ -1,2 +1,2 @@
configured_endpoints: 1267
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-5c41a7aa9877639ecb82e8e278d9d8d77a58f9d308ed8e8f570cd3243f130e05.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-c009571890021a3ddaeb9603ffbfa1f8f23f2ec22c247cd9a1c3bda38e37cac6.yml
1 change: 0 additions & 1 deletion shared/union.go
Expand Up @@ -82,7 +82,6 @@ func (UnionString) ImplementsRateLimitsRateLimitEditResponseUnion()
func (UnionString) ImplementsRateLimitsRateLimitGetResponseUnion() {}
func (UnionString) ImplementsWorkersAIRunResponseUnion() {}
func (UnionString) ImplementsWorkersAIRunParamsBodyTextEmbeddingsTextUnion() {}
func (UnionString) ImplementsWorkersAIRunParamsBodyImageToTextImageUnion() {}
func (UnionString) ImplementsKVNamespaceUpdateResponseUnion() {}
func (UnionString) ImplementsKVNamespaceDeleteResponseUnion() {}
func (UnionString) ImplementsKVNamespaceBulkUpdateResponseUnion() {}
Expand Down
30 changes: 7 additions & 23 deletions workers/ai.go
Expand Up @@ -55,8 +55,7 @@ func (r *AIService) Run(ctx context.Context, modelName string, params AIRunParam
}

// Union satisfied by [workers.AIRunResponseTextClassification],
// [shared.UnionString], [shared.UnionString],
// [workers.AIRunResponseSentenceSimilarity],
// [shared.UnionString], [workers.AIRunResponseSentenceSimilarity],
// [workers.AIRunResponseTextEmbeddings], [workers.AIRunResponseSpeechRecognition],
// [workers.AIRunResponseImageClassification],
// [workers.AIRunResponseObjectDetection], [workers.AIRunResponseObject],
Expand All @@ -78,10 +77,6 @@ func init() {
TypeFilter: gjson.String,
Type: reflect.TypeOf(shared.UnionString("")),
},
apijson.UnionVariant{
TypeFilter: gjson.String,
Type: reflect.TypeOf(shared.UnionString("")),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(AIRunResponseSentenceSimilarity{}),
Expand Down Expand Up @@ -499,12 +494,12 @@ func (r AIRunParamsBodySummarization) MarshalJSON() (data []byte, err error) {
func (r AIRunParamsBodySummarization) implementsWorkersAIRunParamsBodyUnion() {}

type AIRunParamsBodyImageToText struct {
Image param.Field[AIRunParamsBodyImageToTextImageUnion] `json:"image,required" format:"base64"`
MaxTokens param.Field[int64] `json:"max_tokens"`
Messages param.Field[[]AIRunParamsBodyImageToTextMessage] `json:"messages"`
Prompt param.Field[string] `json:"prompt"`
Raw param.Field[bool] `json:"raw"`
Temperature param.Field[float64] `json:"temperature"`
Image param.Field[[]float64] `json:"image,required"`
MaxTokens param.Field[int64] `json:"max_tokens"`
Messages param.Field[[]AIRunParamsBodyImageToTextMessage] `json:"messages"`
Prompt param.Field[string] `json:"prompt"`
Raw param.Field[bool] `json:"raw"`
Temperature param.Field[float64] `json:"temperature"`
}

func (r AIRunParamsBodyImageToText) MarshalJSON() (data []byte, err error) {
Expand All @@ -513,17 +508,6 @@ func (r AIRunParamsBodyImageToText) MarshalJSON() (data []byte, err error) {

func (r AIRunParamsBodyImageToText) implementsWorkersAIRunParamsBodyUnion() {}

// Satisfied by [workers.AIRunParamsBodyImageToTextImageArray],
// [shared.UnionString].
type AIRunParamsBodyImageToTextImageUnion interface {
ImplementsWorkersAIRunParamsBodyImageToTextImageUnion()
}

type AIRunParamsBodyImageToTextImageArray []float64

func (r AIRunParamsBodyImageToTextImageArray) ImplementsWorkersAIRunParamsBodyImageToTextImageUnion() {
}

type AIRunParamsBodyImageToTextMessage struct {
Content param.Field[string] `json:"content,required"`
Role param.Field[string] `json:"role,required"`
Expand Down

0 comments on commit ce25fff

Please sign in to comment.