Skip to content

Commit

Permalink
SDK regeneration
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Feb 27, 2025
1 parent 5d8e236 commit f6bbb1c
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 1 deletion.
84 changes: 84 additions & 0 deletions ad_hoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,77 @@ func (c *ChatMessagePromptBlock) String() string {
return fmt.Sprintf("%#v", c)
}

// A block that represents a document in a prompt template.
type DocumentPromptBlock struct {
State *PromptBlockState `json:"state,omitempty" url:"state,omitempty"`
CacheConfig *EphemeralPromptCacheConfig `json:"cache_config,omitempty" url:"cache_config,omitempty"`
Src string `json:"src" url:"src"`
Metadata map[string]interface{} `json:"metadata,omitempty" url:"metadata,omitempty"`
blockType string

extraProperties map[string]interface{}
_rawJSON json.RawMessage
}

func (d *DocumentPromptBlock) GetExtraProperties() map[string]interface{} {
return d.extraProperties
}

func (d *DocumentPromptBlock) BlockType() string {
return d.blockType
}

func (d *DocumentPromptBlock) UnmarshalJSON(data []byte) error {
type embed DocumentPromptBlock
var unmarshaler = struct {
embed
BlockType string `json:"block_type"`
}{
embed: embed(*d),
}
if err := json.Unmarshal(data, &unmarshaler); err != nil {
return err
}
*d = DocumentPromptBlock(unmarshaler.embed)
if unmarshaler.BlockType != "DOCUMENT" {
return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", d, "DOCUMENT", unmarshaler.BlockType)
}
d.blockType = unmarshaler.BlockType

extraProperties, err := core.ExtractExtraProperties(data, *d, "block_type")
if err != nil {
return err
}
d.extraProperties = extraProperties

d._rawJSON = json.RawMessage(data)
return nil
}

func (d *DocumentPromptBlock) MarshalJSON() ([]byte, error) {
type embed DocumentPromptBlock
var marshaler = struct {
embed
BlockType string `json:"block_type"`
}{
embed: embed(*d),
BlockType: "DOCUMENT",
}
return json.Marshal(marshaler)
}

func (d *DocumentPromptBlock) String() string {
if len(d._rawJSON) > 0 {
if value, err := core.StringifyJSON(d._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(d); err == nil {
return value
}
return fmt.Sprintf("%#v", d)
}

type EphemeralPromptCacheConfig struct {
Type *EphemeralPromptCacheConfigTypeEnum `json:"type,omitempty" url:"type,omitempty"`

Expand Down Expand Up @@ -980,6 +1051,7 @@ type PromptBlock struct {
AudioPromptBlock *AudioPromptBlock
FunctionCallPromptBlock *FunctionCallPromptBlock
ImagePromptBlock *ImagePromptBlock
DocumentPromptBlock *DocumentPromptBlock
}

func (p *PromptBlock) UnmarshalJSON(data []byte) error {
Expand Down Expand Up @@ -1018,6 +1090,11 @@ func (p *PromptBlock) UnmarshalJSON(data []byte) error {
p.ImagePromptBlock = valueImagePromptBlock
return nil
}
valueDocumentPromptBlock := new(DocumentPromptBlock)
if err := json.Unmarshal(data, &valueDocumentPromptBlock); err == nil {
p.DocumentPromptBlock = valueDocumentPromptBlock
return nil
}
return fmt.Errorf("%s cannot be deserialized as a %T", data, p)
}

Expand All @@ -1043,6 +1120,9 @@ func (p PromptBlock) MarshalJSON() ([]byte, error) {
if p.ImagePromptBlock != nil {
return json.Marshal(p.ImagePromptBlock)
}
if p.DocumentPromptBlock != nil {
return json.Marshal(p.DocumentPromptBlock)
}
return nil, fmt.Errorf("type %T does not include a non-empty union type", p)
}

Expand All @@ -1054,6 +1134,7 @@ type PromptBlockVisitor interface {
VisitAudioPromptBlock(*AudioPromptBlock) error
VisitFunctionCallPromptBlock(*FunctionCallPromptBlock) error
VisitImagePromptBlock(*ImagePromptBlock) error
VisitDocumentPromptBlock(*DocumentPromptBlock) error
}

func (p *PromptBlock) Accept(visitor PromptBlockVisitor) error {
Expand All @@ -1078,6 +1159,9 @@ func (p *PromptBlock) Accept(visitor PromptBlockVisitor) error {
if p.ImagePromptBlock != nil {
return visitor.VisitImagePromptBlock(p.ImagePromptBlock)
}
if p.DocumentPromptBlock != nil {
return visitor.VisitDocumentPromptBlock(p.DocumentPromptBlock)
}
return fmt.Errorf("type %T does not include a non-empty union type", p)
}

Expand Down
2 changes: 1 addition & 1 deletion core/request_option.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (r *RequestOptions) cloneHeader() http.Header {
headers := r.HTTPHeader.Clone()
headers.Set("X-Fern-Language", "Go")
headers.Set("X-Fern-SDK-Name", "github.com/vellum-ai/vellum-client-go")
headers.Set("X-Fern-SDK-Version", "v0.14.7")
headers.Set("X-Fern-SDK-Version", "v0.0.2316")
return headers
}

Expand Down

0 comments on commit f6bbb1c

Please sign in to comment.