diff --git a/.trunk/configs/.markdownlint.json b/.trunk/configs/.markdownlint.json index 26593a22..6e1ca8be 100644 --- a/.trunk/configs/.markdownlint.json +++ b/.trunk/configs/.markdownlint.json @@ -1,4 +1,5 @@ { "MD013": false, - "MD033": false + "MD033": false, + "MD034": false } diff --git a/deploy.mdx b/deploy.mdx index 69115aba..3ef69211 100644 --- a/deploy.mdx +++ b/deploy.mdx @@ -11,7 +11,7 @@ Hypermode leverages a native GitHub integration for the deployment of Hypermode ## Build -A GitHub Action is available in the [template project](https://github.com/hypermodeAI/sample-project) to handle the build of your project's functions. This Action must complete successfully before your functions deploy. +The [template project](https://github.com/hypermodeAI/template-project) includes a GitHub Action to build your project's functions. On success, the action deploys your functions to Hypermode when committing or merging to the branch defined in the Hypermode Console.``` ## Deploy diff --git a/mint.json b/mint.json index e7dd8ac6..10889f90 100644 --- a/mint.json +++ b/mint.json @@ -59,6 +59,7 @@ "group": "Write Functions", "pages": [ "sdk/functions-sdk", + "sdk/http", "sdk/connection", "sdk/inference", "sdk/search", @@ -66,7 +67,7 @@ ] }, { - "group": "Iterate Constantly", + "group": "Observe and Iterate", "pages": ["deploy", "function-observability"] } ], diff --git a/sdk/connection.mdx b/sdk/connection.mdx index 1453665d..2c4b06b3 100644 --- a/sdk/connection.mdx +++ b/sdk/connection.mdx @@ -16,21 +16,64 @@ Connection APIs allow you to securely access an API endpoint at a defined host. Make a query or mutation against a GraphQL API endpoint. ```TypeScript -invokeGraphqlApi ( +invokeGraphqlApi ( hostName: string, - query: string, - variables?: Map -): string + statement: string, + variables?: QueryVariables +): GQLResponse ``` + + Type of object to use for the data returned from the query. + + Internal name of your host, as [defined in your manifest](../define-hosts). - + GraphQL operation for execution on your API server to retrieve or write data. - + Optional variables added to the query. + +Example: + +```TypeScript +const vars = new QueryVariables(); +vars.set("firstName", firstName); +vars.set("lastName", lastName); +``` + + + +### GQLResponse object + +A response object from the GraphQL query. + + + The results of the GraphQL operation. + + + Any errors incurred as part of your GraphQL request. + + + Description of the error incurred. + + + Query path of the error incurred. Each item in the array represents a + segment of the path. + + + + + Specific line number of the request that points to the error. + + + Specific column number of the request that points to the error. + + + + diff --git a/sdk/functions-sdk.mdx b/sdk/functions-sdk.mdx index 05a43633..647002e2 100644 --- a/sdk/functions-sdk.mdx +++ b/sdk/functions-sdk.mdx @@ -8,18 +8,22 @@ The Functions SDK gives your project access to a set of APIs that simplify the d The Functions SDK includes support for AssemblyScript, a portable - TypeScript-like language. Support for Golang is in development. + TypeScript-like language. Additional language support is in development. +For inspiration on getting started, reference the [examples in the Function SDK repo](https://github.com/hypermodeAI/functions-as/tree/main/examples). + ## APIs - + + Securely call and fetch data from an HTTP endpoint. + + Augment functions with secure access to data in your databases and APIs. - Use AI models for classification, summarization, and other generation use - cases. + Use AI models for classifying, summarizing, and generation use cases. Use embeddings for semantic similarity search, clustering, and outlier diff --git a/sdk/http.mdx b/sdk/http.mdx new file mode 100644 index 00000000..0473a3cc --- /dev/null +++ b/sdk/http.mdx @@ -0,0 +1,72 @@ +--- +title: HTTP +description: "" +--- + +The HTTP API allows you to securely call and fetch data from an HTTP endpoint. + + + We're introducing new APIs consistently through ongoing development with build + partners. [Let's chat](mailto:help@hypermode.com) about what would make the + Functions SDK even more powerful for your next use case! + + +### fetch + +Invoke an HTTP endpoint to retrieve data or trigger external action. + +```TypeScript +fetch ( + request: Request, +): Response +``` + + + A [Request](#request-object) object for calling an HTTP endpoint. + + + + A [Response](#response-object) object from the HTTP endpoint. + + +### Request object + + + The URL to send the request to. You must have a corresponding + [Host](/define-hosts) in your project's manifest. + +Example: https://example.com/whatever + + + + The HTTP method to use for the request. + +Example: "GET" + + + + The HTTP headers for the request, as [defined in your + manifest](../define-hosts). + + + The raw HTTP request body, as an `ArrayBuffer`. + + +### Response object + + + The HTTP response status code. Example: 200 + + + The HTTP response status text. Example: "OK" + + + The HTTP response headers. + + + The raw HTTP response body, as an `ArrayBuffer`. + + + The response body isn't normally read directly. Instead, use `response.text()` or `response.json()` functions. + + diff --git a/sdk/inference.mdx b/sdk/inference.mdx index c774f730..49c15cf3 100644 --- a/sdk/inference.mdx +++ b/sdk/inference.mdx @@ -35,15 +35,41 @@ generateText ( Queries for response within the context of the given instruction. -### computeClassificationLabels +### classifyText + +Invoke a fine-tuned classification model with a text input, resulting in a single classification label that exceeds the provided threshold. + +```TypeScript +classifyText ( + modelName: string, + text: string, + threshold: f32 +): string +``` + + + Internal name of your model, as [defined in your manifest](../define-models). + + + + Text input for classification amongst labels defined in the fine-tuning + process. + + + + Confidence factor for classification. If no labels exist with a probability + higher than this threshold, the model won't produce a result. + + +### getClassificationLabelsForText Invoke a fine-tuned classification model with a text input, resulting in an array of labels and probabilities. ```TypeScript -computeClassificationLabels ( +getClassificationLabelsForText ( modelName: string, text: string -): Map +): Map ``` @@ -55,15 +81,59 @@ computeClassificationLabels ( process. -### embedText +### getClassificationLabelsForTexts -Invoke an embedding model with a text input, resulting in a vector embedding. +Invoke a fine-tuned classification model with multiple text inputs, resulting in an array of an array of labels and probabilities. + +```TypeScript +getClassificationLabelsForTexts ( + modelName: string, + texts: Map +): Map> +``` + + + Internal name of your model, as [defined in your manifest](../define-models). + + + + Text inputs for classification amongst labels defined in the fine-tuning + process. + + +### getClassificationProbability + +Invoke a fine-tuned classification model with a text input, resulting in the probability of the provided label. ```TypeScript -embedText ( +getClassificationProbability ( modelName: string, text: string, -): number + label: string +): f32 +``` + + + Internal name of your model, as [defined in your manifest](../define-models). + + + + Text input for classification based on the label provided. + + + + The label to classify the provided text against. + + +### getTextEmbedding + +Invoke an embedding model with a text input, resulting in a vector embedding. + +```TypeScript +getTextEmbedding ( + modelName: string, + text: string +): f64[] ``` @@ -73,3 +143,22 @@ embedText ( Text input for embedding. + +### getTextEmbeddings + +Invoke an embedding model with multiple text inputs, resulting in an array of vector embeddings. + +```TypeScript +getTextEmbeddings ( + modelName: string, + texts: Map +): Map +``` + + + Internal name of your model, as [defined in your manifest](../define-models). + + + + Text inputs for embedding. + diff --git a/sdk/search.mdx b/sdk/search.mdx index 28d0e674..242bdd58 100644 --- a/sdk/search.mdx +++ b/sdk/search.mdx @@ -9,4 +9,4 @@ description: "Add search into your functions" Functions SDK even more powerful for your next use case! -The [embedText](/sdk/inference#embedtext) API creates text embeddings for use in semantic similarity search use cases. +The [getTextEmbedding](/sdk/inference#getTextEmbedding) API creates text embeddings for use in semantic similarity search use cases. diff --git a/styles/config/vocabularies/general/accept.txt b/styles/config/vocabularies/general/accept.txt index b708f27f..de22ba41 100644 --- a/styles/config/vocabularies/general/accept.txt +++ b/styles/config/vocabularies/general/accept.txt @@ -2,9 +2,16 @@ APIs inferencing +repo invokeGraphqlApi +fetch generateText -computeClassificationLabels -embedText -log \ No newline at end of file +classifyText +getClassificationLabelsForText +getClassificationLabelsForTexts +getClassificationProbability +getTextEmbedding +getTextEmbeddings +log +GQLResponse \ No newline at end of file