Skip to content

Commit

Permalink
Release v0.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Apr 1, 2024
1 parent 65f2986 commit 9ab4cdb
Show file tree
Hide file tree
Showing 16 changed files with 223 additions and 158 deletions.
10 changes: 5 additions & 5 deletions collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ type CreateDocumentCollectionRequest struct {
Description *string `json:"description,omitempty" url:"description,omitempty"`
EmbeddingDimensions int `json:"embedding_dimensions" url:"embedding_dimensions"`
// these needs to be pointers so that we can distinguish between false and unset when validating
IsAutoEmbedded bool `json:"is_auto_embedded" url:"is_auto_embedded"`
Metadata map[string]map[string]interface{} `json:"metadata,omitempty" url:"metadata,omitempty"`
Name string `json:"name" url:"name"`
IsAutoEmbedded bool `json:"is_auto_embedded" url:"is_auto_embedded"`
Metadata map[string]interface{} `json:"metadata,omitempty" url:"metadata,omitempty"`
Name string `json:"name" url:"name"`
}

type CollectionCreateIndexRequest struct {
Expand All @@ -17,6 +17,6 @@ type CollectionCreateIndexRequest struct {
}

type UpdateDocumentCollectionRequest struct {
Description *string `json:"description,omitempty" url:"description,omitempty"`
Metadata map[string]map[string]interface{} `json:"metadata,omitempty" url:"metadata,omitempty"`
Description *string `json:"description,omitempty" url:"description,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty" url:"metadata,omitempty"`
}
12 changes: 6 additions & 6 deletions collection/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (c *Client) List(
) ([][]*zepgo.DocumentCollectionResponse, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://app.getzep.com/api/v2"
baseURL := "https://api.getzep.com/api/v2"
if c.baseURL != "" {
baseURL = c.baseURL
}
Expand Down Expand Up @@ -106,7 +106,7 @@ func (c *Client) Get(
) (*zepgo.DocumentCollectionResponse, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://app.getzep.com/api/v2"
baseURL := "https://api.getzep.com/api/v2"
if c.baseURL != "" {
baseURL = c.baseURL
}
Expand Down Expand Up @@ -185,7 +185,7 @@ func (c *Client) Create(
) (string, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://app.getzep.com/api/v2"
baseURL := "https://api.getzep.com/api/v2"
if c.baseURL != "" {
baseURL = c.baseURL
}
Expand Down Expand Up @@ -264,7 +264,7 @@ func (c *Client) Delete(
) (string, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://app.getzep.com/api/v2"
baseURL := "https://api.getzep.com/api/v2"
if c.baseURL != "" {
baseURL = c.baseURL
}
Expand Down Expand Up @@ -342,7 +342,7 @@ func (c *Client) Update(
) (string, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://app.getzep.com/api/v2"
baseURL := "https://api.getzep.com/api/v2"
if c.baseURL != "" {
baseURL = c.baseURL
}
Expand Down Expand Up @@ -422,7 +422,7 @@ func (c *Client) CreateIndex(
) (string, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://app.getzep.com/api/v2"
baseURL := "https://api.getzep.com/api/v2"
if c.baseURL != "" {
baseURL = c.baseURL
}
Expand Down
2 changes: 1 addition & 1 deletion core/request_option.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,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/getzep/zep-go")
headers.Set("X-Fern-SDK-Version", "v0.0.1")
headers.Set("X-Fern-SDK-Version", "v0.0.2")
return headers
}

Expand Down
12 changes: 6 additions & 6 deletions document.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ type GetDocumentListRequest struct {

type DocumentSearchPayload struct {
// Limit the number of returned documents
Limit *int `json:"-" url:"limit,omitempty"`
CollectionName *string `json:"collection_name,omitempty" url:"collection_name,omitempty"`
Embedding []float64 `json:"embedding,omitempty" url:"embedding,omitempty"`
Metadata map[string]map[string]interface{} `json:"metadata,omitempty" url:"metadata,omitempty"`
Limit *int `json:"-" url:"limit,omitempty"`
CollectionName *string `json:"collection_name,omitempty" url:"collection_name,omitempty"`
Embedding []float64 `json:"embedding,omitempty" url:"embedding,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty" url:"metadata,omitempty"`
// TODO: implement for documents
MinScore *float64 `json:"min_score,omitempty" url:"min_score,omitempty"`
MmrLambda *float64 `json:"mmr_lambda,omitempty" url:"mmr_lambda,omitempty"`
Expand All @@ -21,6 +21,6 @@ type DocumentSearchPayload struct {
}

type UpdateDocumentRequest struct {
DocumentID *string `json:"document_id,omitempty" url:"document_id,omitempty"`
Metadata map[string]map[string]interface{} `json:"metadata,omitempty" url:"metadata,omitempty"`
DocumentID *string `json:"document_id,omitempty" url:"document_id,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty" url:"metadata,omitempty"`
}
16 changes: 8 additions & 8 deletions document/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (c *Client) Update(
) (string, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://app.getzep.com/api/v2"
baseURL := "https://api.getzep.com/api/v2"
if c.baseURL != "" {
baseURL = c.baseURL
}
Expand Down Expand Up @@ -127,7 +127,7 @@ func (c *Client) Get(
) (*zepgo.DocumentResponse, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://app.getzep.com/api/v2"
baseURL := "https://api.getzep.com/api/v2"
if c.baseURL != "" {
baseURL = c.baseURL
}
Expand Down Expand Up @@ -199,7 +199,7 @@ func (c *Client) CreateMultiple(
) ([]string, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://app.getzep.com/api/v2"
baseURL := "https://api.getzep.com/api/v2"
if c.baseURL != "" {
baseURL = c.baseURL
}
Expand Down Expand Up @@ -272,7 +272,7 @@ func (c *Client) BatchDelete(
) (string, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://app.getzep.com/api/v2"
baseURL := "https://api.getzep.com/api/v2"
if c.baseURL != "" {
baseURL = c.baseURL
}
Expand Down Expand Up @@ -345,7 +345,7 @@ func (c *Client) BatchGet(
) ([][]*zepgo.DocumentResponse, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://app.getzep.com/api/v2"
baseURL := "https://api.getzep.com/api/v2"
if c.baseURL != "" {
baseURL = c.baseURL
}
Expand Down Expand Up @@ -418,7 +418,7 @@ func (c *Client) BatchUpdate(
) (string, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://app.getzep.com/api/v2"
baseURL := "https://api.getzep.com/api/v2"
if c.baseURL != "" {
baseURL = c.baseURL
}
Expand Down Expand Up @@ -492,7 +492,7 @@ func (c *Client) Delete(
) (string, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://app.getzep.com/api/v2"
baseURL := "https://api.getzep.com/api/v2"
if c.baseURL != "" {
baseURL = c.baseURL
}
Expand Down Expand Up @@ -571,7 +571,7 @@ func (c *Client) Search(
) (*zepgo.DocumentSearchResultPage, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://app.getzep.com/api/v2"
baseURL := "https://api.getzep.com/api/v2"
if c.baseURL != "" {
baseURL = c.baseURL
}
Expand Down
2 changes: 1 addition & 1 deletion environments.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ package zep
var Environments = struct {
Default string
}{
Default: "https://app.getzep.com/api/v2",
Default: "https://api.getzep.com/api/v2",
}
31 changes: 30 additions & 1 deletion memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

package zep

import (
fmt "fmt"
)

type MemoryGetRequest struct {
// memoryType: perpetual or message_window
MemoryType *string `json:"-" url:"memoryType,omitempty"`
MemoryType MemoryGetRequestMemoryType `json:"-" url:"memoryType,omitempty"`
// Last N messages. Overrides memory_window configuration
Lastn *int `json:"-" url:"lastn,omitempty"`
}
Expand All @@ -13,3 +17,28 @@ type MemorySynthesizeQuestionRequest struct {
// Last N messages
LastNMessages *int `json:"-" url:"lastNMessages,omitempty"`
}

type MemoryGetRequestMemoryType string

const (
MemoryGetRequestMemoryTypePerpetual MemoryGetRequestMemoryType = "perpetual"
MemoryGetRequestMemoryTypeSummaryRetriever MemoryGetRequestMemoryType = "summary_retriever"
MemoryGetRequestMemoryTypeMessageWindow MemoryGetRequestMemoryType = "message_window"
)

func NewMemoryGetRequestMemoryTypeFromString(s string) (MemoryGetRequestMemoryType, error) {
switch s {
case "perpetual":
return MemoryGetRequestMemoryTypePerpetual, nil
case "summary_retriever":
return MemoryGetRequestMemoryTypeSummaryRetriever, nil
case "message_window":
return MemoryGetRequestMemoryTypeMessageWindow, nil
}
var t MemoryGetRequestMemoryType
return "", fmt.Errorf("%s is not a valid %T", s, t)
}

func (m MemoryGetRequestMemoryType) Ptr() *MemoryGetRequestMemoryType {
return &m
}
20 changes: 9 additions & 11 deletions memory/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ func (c *Client) Get(
sessionID string,
request *zepgo.MemoryGetRequest,
opts ...option.RequestOption,
) ([]*zepgo.Memory, error) {
) (*zepgo.Memory, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://app.getzep.com/api/v2"
baseURL := "https://api.getzep.com/api/v2"
if c.baseURL != "" {
baseURL = c.baseURL
}
Expand Down Expand Up @@ -90,7 +90,7 @@ func (c *Client) Get(
return apiError
}

var response []*zepgo.Memory
var response *zepgo.Memory
if err := c.caller.Call(
ctx,
&core.CallParams{
Expand All @@ -115,10 +115,10 @@ func (c *Client) Create(
sessionID string,
request *zepgo.Memory,
opts ...option.RequestOption,
) (string, error) {
) error {
options := core.NewRequestOptions(opts...)

baseURL := "https://app.getzep.com/api/v2"
baseURL := "https://api.getzep.com/api/v2"
if c.baseURL != "" {
baseURL = c.baseURL
}
Expand Down Expand Up @@ -148,7 +148,6 @@ func (c *Client) Create(
return apiError
}

var response string
if err := c.caller.Call(
ctx,
&core.CallParams{
Expand All @@ -158,13 +157,12 @@ func (c *Client) Create(
Headers: headers,
Client: options.HTTPClient,
Request: request,
Response: &response,
ErrorDecoder: errorDecoder,
},
); err != nil {
return "", err
return err
}
return response, nil
return nil
}

// delete memory messages by session id
Expand All @@ -176,7 +174,7 @@ func (c *Client) Delete(
) (string, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://app.getzep.com/api/v2"
baseURL := "https://api.getzep.com/api/v2"
if c.baseURL != "" {
baseURL = c.baseURL
}
Expand Down Expand Up @@ -241,7 +239,7 @@ func (c *Client) SynthesizeQuestion(
) (*zepgo.Question, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://app.getzep.com/api/v2"
baseURL := "https://api.getzep.com/api/v2"
if c.baseURL != "" {
baseURL = c.baseURL
}
Expand Down
6 changes: 3 additions & 3 deletions messages/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (c *Client) List(
) ([]*zepgo.Message, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://app.getzep.com/api/v2"
baseURL := "https://api.getzep.com/api/v2"
if c.baseURL != "" {
baseURL = c.baseURL
}
Expand Down Expand Up @@ -110,7 +110,7 @@ func (c *Client) Get(
) (*zepgo.Message, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://app.getzep.com/api/v2"
baseURL := "https://api.getzep.com/api/v2"
if c.baseURL != "" {
baseURL = c.baseURL
}
Expand Down Expand Up @@ -177,7 +177,7 @@ func (c *Client) Update(
) (*zepgo.Message, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://app.getzep.com/api/v2"
baseURL := "https://api.getzep.com/api/v2"
if c.baseURL != "" {
baseURL = c.baseURL
}
Expand Down
16 changes: 8 additions & 8 deletions search.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ package zep

type MemorySearchPayload struct {
// Limit the number of results returned
Limit *int `json:"-" url:"limit,omitempty"`
Embedding []float64 `json:"embedding,omitempty" url:"embedding,omitempty"`
Metadata map[string]map[string]interface{} `json:"metadata,omitempty" url:"metadata,omitempty"`
MinScore *float64 `json:"min_score,omitempty" url:"min_score,omitempty"`
MmrLambda *float64 `json:"mmr_lambda,omitempty" url:"mmr_lambda,omitempty"`
SearchScope *SearchScope `json:"search_scope,omitempty" url:"search_scope,omitempty"`
SearchType *SearchType `json:"search_type,omitempty" url:"search_type,omitempty"`
Text *string `json:"text,omitempty" url:"text,omitempty"`
Limit *int `json:"-" url:"limit,omitempty"`
Embedding []float64 `json:"embedding,omitempty" url:"embedding,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty" url:"metadata,omitempty"`
MinScore *float64 `json:"min_score,omitempty" url:"min_score,omitempty"`
MmrLambda *float64 `json:"mmr_lambda,omitempty" url:"mmr_lambda,omitempty"`
SearchScope *SearchScope `json:"search_scope,omitempty" url:"search_scope,omitempty"`
SearchType *SearchType `json:"search_type,omitempty" url:"search_type,omitempty"`
Text *string `json:"text,omitempty" url:"text,omitempty"`
}
2 changes: 1 addition & 1 deletion search/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (c *Client) Get(
) ([]*zepgo.MemorySearchResult, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://app.getzep.com/api/v2"
baseURL := "https://api.getzep.com/api/v2"
if c.baseURL != "" {
baseURL = c.baseURL
}
Expand Down
18 changes: 9 additions & 9 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
package zep

type ClassifySessionRequest struct {
Classes []string `json:"classes,omitempty" url:"classes,omitempty"`
LastN *int `json:"last_n,omitempty" url:"last_n,omitempty"`
Name *string `json:"name,omitempty" url:"name,omitempty"`
Persist *bool `json:"persist,omitempty" url:"persist,omitempty"`
SessionID *string `json:"session_id,omitempty" url:"session_id,omitempty"`
Classes []string `json:"classes,omitempty" url:"classes,omitempty"`
Instruction *string `json:"instruction,omitempty" url:"instruction,omitempty"`
LastN *int `json:"last_n,omitempty" url:"last_n,omitempty"`
Name string `json:"name" url:"name"`
Persist *bool `json:"persist,omitempty" url:"persist,omitempty"`
}

type CreateSessionRequest struct {
Metadata map[string]map[string]interface{} `json:"metadata,omitempty" url:"metadata,omitempty"`
SessionID *string `json:"session_id,omitempty" url:"session_id,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty" url:"metadata,omitempty"`
SessionID *string `json:"session_id,omitempty" url:"session_id,omitempty"`
// Must be a pointer to allow for null values
UserID *string `json:"user_id,omitempty" url:"user_id,omitempty"`
}
Expand All @@ -25,6 +25,6 @@ type SessionListRequest struct {
}

type UpdateSessionRequest struct {
Metadata map[string]map[string]interface{} `json:"metadata,omitempty" url:"metadata,omitempty"`
SessionID *string `json:"session_id,omitempty" url:"session_id,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty" url:"metadata,omitempty"`
SessionID *string `json:"session_id,omitempty" url:"session_id,omitempty"`
}
Loading

0 comments on commit 9ab4cdb

Please sign in to comment.