Browse Source

added cost field

Dax Raad 9 months ago
parent
commit
520cd02dd5
2 changed files with 24 additions and 12 deletions
  1. 10 1
      pkg/client/gen/openapi.json
  2. 14 11
      pkg/client/generated-client.go

+ 10 - 1
pkg/client/gen/openapi.json

@@ -122,6 +122,9 @@
                       "title": {
                         "type": "string"
                       },
+                      "cost": {
+                        "type": "number"
+                      },
                       "tokens": {
                         "type": "object",
                         "properties": {
@@ -235,6 +238,9 @@
           "title": {
             "type": "string"
           },
+          "cost": {
+            "type": "number"
+          },
           "tokens": {
             "type": "object",
             "properties": {
@@ -632,7 +638,10 @@
               ]
             }
           }
-        }
+        },
+        "required": [
+          "models"
+        ]
       }
     }
   }

+ 14 - 11
pkg/client/generated-client.go

@@ -26,7 +26,7 @@ const (
 
 // ProviderInfo defines model for Provider.Info.
 type ProviderInfo struct {
-	Models *map[string]struct {
+	Models map[string]struct {
 		Attachment    bool    `json:"attachment"`
 		ContextWindow float32 `json:"contextWindow"`
 		Cost          struct {
@@ -37,15 +37,16 @@ type ProviderInfo struct {
 		} `json:"cost"`
 		MaxTokens float32 `json:"maxTokens"`
 		Name      *string `json:"name,omitempty"`
-	} `json:"models,omitempty"`
+	} `json:"models"`
 	Options *map[string]interface{} `json:"options,omitempty"`
 }
 
 // SessionInfo defines model for Session.Info.
 type SessionInfo struct {
-	Id      string  `json:"id"`
-	ShareID *string `json:"shareID,omitempty"`
-	Title   string  `json:"title"`
+	Cost    *float32 `json:"cost,omitempty"`
+	Id      string   `json:"id"`
+	ShareID *string  `json:"shareID,omitempty"`
+	Title   string   `json:"title"`
 	Tokens  struct {
 		Input     float32 `json:"input"`
 		Output    float32 `json:"output"`
@@ -1049,9 +1050,10 @@ type PostSessionListResponse struct {
 	Body         []byte
 	HTTPResponse *http.Response
 	JSON200      *[]struct {
-		Id      string  `json:"id"`
-		ShareID *string `json:"shareID,omitempty"`
-		Title   string  `json:"title"`
+		Cost    *float32 `json:"cost,omitempty"`
+		Id      string   `json:"id"`
+		ShareID *string  `json:"shareID,omitempty"`
+		Title   string   `json:"title"`
 		Tokens  struct {
 			Input     float32 `json:"input"`
 			Output    float32 `json:"output"`
@@ -1282,9 +1284,10 @@ func ParsePostSessionListResponse(rsp *http.Response) (*PostSessionListResponse,
 	switch {
 	case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
 		var dest []struct {
-			Id      string  `json:"id"`
-			ShareID *string `json:"shareID,omitempty"`
-			Title   string  `json:"title"`
+			Cost    *float32 `json:"cost,omitempty"`
+			Id      string   `json:"id"`
+			ShareID *string  `json:"shareID,omitempty"`
+			Title   string   `json:"title"`
 			Tokens  struct {
 				Input     float32 `json:"input"`
 				Output    float32 `json:"output"`