-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added shazam, youtube summarization, image2text, docGPT features.
- Loading branch information
1 parent
f734c1c
commit c6449cd
Showing
10 changed files
with
121 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package omnicron | ||
|
||
import ( | ||
"context" | ||
"os" | ||
) | ||
|
||
type DocGPTParams struct { | ||
File *os.File `form:"file"` | ||
Prompt string `form:"prompt"` | ||
} | ||
|
||
func (c *Client) DocGPT(ctx context.Context, req DocGPTParams) (*GabsContainer, error) { | ||
if req.File == nil { | ||
return nil, ErrNoFileProvided | ||
} | ||
if req.Prompt == "" { | ||
return nil, ErrPromptMissing | ||
} | ||
|
||
body, err := c.newFormWithFilePostRequest(ctx, "/docgpt", "", req) | ||
if err != nil { | ||
return nil, err | ||
} | ||
docGPTResponse, err := unmarshalJSONResponse(body) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return docGPTResponse, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package omnicron | ||
|
||
import ( | ||
"context" | ||
"os" | ||
) | ||
|
||
type ImageToTextParams struct { | ||
File *os.File `form:"file"` | ||
} | ||
|
||
func (c *Client) ImageToText(ctx context.Context, params ImageToTextParams) (*GabsContainer, error) { | ||
if params.File == nil { | ||
return nil, ErrNoFileProvided | ||
} | ||
body, err := c.newFormWithFilePostRequest(ctx, "/image2text", "", params) | ||
if err != nil { | ||
return nil, err | ||
} | ||
imageToTextResponse, err := unmarshalJSONResponse(body) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return imageToTextResponse, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package omnicron | ||
|
||
import ( | ||
"context" | ||
"os" | ||
) | ||
|
||
type ShazamParams struct { | ||
File *os.File `form:"file"` | ||
} | ||
|
||
func (c *Client) Shazam(ctx context.Context, params ShazamParams) (*GabsContainer, error) { | ||
if params.File == nil { | ||
return nil, ErrNoFileProvided | ||
} | ||
body, err := c.newFormWithFilePostRequest(ctx, "/shazam", "", params) | ||
if err != nil { | ||
return nil, err | ||
} | ||
shazamResponse, err := unmarshalJSONResponse(body) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return shazamResponse, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package omnicron | ||
|
||
import "context" | ||
|
||
type YoutubeSummarizationParams struct { | ||
URL string `json:"url"` | ||
} | ||
|
||
func (c *Client) YoutubeSummarization(ctx context.Context, params *YoutubeSummarizationParams) (*GabsContainer, error) { | ||
if params.URL == "" { | ||
return nil, ErrVideoDownloadNoURLProvided | ||
} | ||
body, err := c.newJSONPostRequest(ctx, "/youtubesummarization", "", params) | ||
if err != nil { | ||
return nil, err | ||
} | ||
youtubeSummarizationResponse, err := unmarshalJSONResponse(body) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return youtubeSummarizationResponse, nil | ||
|
||
} |