-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added requested changes * Added requested changes * Added requested changes
- Loading branch information
Showing
7 changed files
with
344 additions
and
17 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
components/x_ai/actions/create-embeddings/create-embeddings.mjs
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,57 @@ | ||
import app from "../../x_ai.app.mjs"; | ||
|
||
export default { | ||
key: "x_ai-create-embeddings", | ||
name: "Create Embedding", | ||
description: "Create an embedding vector representation corresponding to the input text. [See the documentation](https://docs.x.ai/api/endpoints#create-embeddings)", | ||
version: "0.0.2", | ||
type: "action", | ||
props: { | ||
app, | ||
embeddingModel: { | ||
propDefinition: [ | ||
app, | ||
"embeddingModel", | ||
], | ||
}, | ||
input: { | ||
propDefinition: [ | ||
app, | ||
"input", | ||
], | ||
}, | ||
dimensions: { | ||
propDefinition: [ | ||
app, | ||
"dimensions", | ||
], | ||
}, | ||
encodingFormat: { | ||
propDefinition: [ | ||
app, | ||
"encodingFormat", | ||
], | ||
}, | ||
user: { | ||
propDefinition: [ | ||
app, | ||
"user", | ||
], | ||
}, | ||
}, | ||
|
||
async run({ $ }) { | ||
const response = await this.app.createEmbeddings({ | ||
$, | ||
data: { | ||
dimensions: this.dimensions, | ||
encoding_format: this.encodingFormat, | ||
input: this.input, | ||
model: this.embeddingModel, | ||
user: this.user, | ||
}, | ||
}); | ||
$.export("$summary", "Successfully created embedding"); | ||
return response; | ||
}, | ||
}; |
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
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,6 @@ | ||
export default { | ||
ENCODING_FORMATS: [ | ||
"float", | ||
"base64", | ||
], | ||
}; |
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
Oops, something went wrong.