Documentation ¶
Index ¶
- type Client
- func (c *Client) Execute(ctx context.Context, actionID string, input string, params map[string]string) (interface{}, error)
- func (c *Client) ExecuteAsString(ctx context.Context, actionID string, input string, params map[string]string) (string, error)
- func (c *Client) List(ctx context.Context) ([]ListResult, error)
- type ClientOptions
- type ListResult
- type NoCredentialsError
- type Transport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client for interacting with Zapier NLA API.
func NewClient ¶
func NewClient(opts ClientOptions) (*Client, error)
Client for Zapier NLA.
Full docs here: https://nla.zapier.com/start/
This Client supports both API Key and OAuth Credential auth methods. API Key is the fastest way to get started using this wrapper.
Call this Client with either `APIKey` or `AccessToken` arguments, or set the `ZAPIER_NLA_API_KEY` environment variable. If both arguments are set, the Access Token will take precedence.
For use-cases where LangChain + Zapier NLA is powering a user-facing application, and LangChain needs access to the end-user's connected accounts on Zapier.com, you'll need to use OAuth. Review the full docs above to learn how to create your own provider and generate credentials.
func (*Client) Execute ¶
func (c *Client) Execute( ctx context.Context, actionID string, input string, params map[string]string, ) (interface{}, error)
Execute an action that is identified by action_id, must be exposed (enabled) by the current user (associated with the set api_key). Change your exposed actions here: https://nla.zapier.com/demo/start/
The return JSON is guaranteed to be less than ~500 words (350 tokens) making it safe to inject into the prompt of another LLM call.
func (*Client) ExecuteAsString ¶
func (c *Client) ExecuteAsString( ctx context.Context, actionID string, input string, params map[string]string, ) (string, error)
ExecuteAsString is a convenience wrapper around Execute that returns a string response.
func (*Client) List ¶
func (c *Client) List(ctx context.Context) ([]ListResult, error)
List returns a list of all exposed (enabled) actions associated with current user (associated with the set api_key). Change your exposed actions here: https://nla.zapier.com/demo/start/
The return list can be empty if no actions exposed. Else will contain a list of ListResult structs, which look like this:
[ ListResult{ "ID": str, "OperationID": str, "Description": str, "Params": Dict[str, str] } ]
`Params` will always contain an `instructions` key, the only required param. All others optional and if provided will override any AI guesses (see "understanding the AI guessing flow" here: https://nla.zapier.com/api/v1/docs).
type ClientOptions ¶
type ClientOptions struct { // User OAuth Access Token for Zapier NLA Takes Precedents over APIKey. AccessToken string // API Key for Zapier NLA. APIKey string // Customer User-Agent if one isn't passed Defaults to "LangChainGo/X.X.X". UserAgent string // Base URL for Zapier NLA API. ZapierNLABaseURL string }
ClientOptions for configuring a new Client.
func (*ClientOptions) Validate ¶
func (cOpts *ClientOptions) Validate() error
type ListResult ¶
type NoCredentialsError ¶
type NoCredentialsError struct{}
NoCredentialsError is thrown when no valid credentials are passed to the client.
func (NoCredentialsError) Error ¶
func (e NoCredentialsError) Error() string
type Transport ¶
type Transport struct { RoundTripper http.RoundTripper UserAgent string // contains filtered or unexported fields }
Transport RoundTripper for Zapier NLA API which adds on Correct Headers.