-
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.
Removed deprecated actions and added chat instead
- Loading branch information
Showing
10 changed files
with
1,333 additions
and
415 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import app from "../../cohere_platform.app.mjs"; | ||
import { clearObj } from "../../common/utils.mjs"; | ||
|
||
export default { | ||
key: "cohere_platform-chat", | ||
name: "Chat", | ||
version: "0.0.1", | ||
description: "Generates a text response to a user message. [See the documentation](https://docs.cohere.com/reference/chat)", | ||
type: "action", | ||
props: { | ||
app, | ||
message: { | ||
propDefinition: [ | ||
app, | ||
"message", | ||
], | ||
}, | ||
model: { | ||
propDefinition: [ | ||
app, | ||
"model", | ||
], | ||
}, | ||
temperature: { | ||
propDefinition: [ | ||
app, | ||
"temperature", | ||
], | ||
}, | ||
maxTokens: { | ||
propDefinition: [ | ||
app, | ||
"maxTokens", | ||
], | ||
}, | ||
k: { | ||
propDefinition: [ | ||
app, | ||
"k", | ||
], | ||
}, | ||
p: { | ||
propDefinition: [ | ||
app, | ||
"p", | ||
], | ||
}, | ||
stopSequences: { | ||
propDefinition: [ | ||
app, | ||
"stopSequences", | ||
], | ||
}, | ||
frequencyPenalty: { | ||
propDefinition: [ | ||
app, | ||
"frequencyPenalty", | ||
], | ||
}, | ||
}, | ||
methods: { | ||
chat(data) { | ||
return this.app.client().chat(data); | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { | ||
chat, | ||
message, | ||
model, | ||
temperature, | ||
maxTokens, | ||
k, | ||
p, | ||
stopSequences, | ||
frequencyPenalty, | ||
|
||
} = this; | ||
const response = await chat(clearObj({ | ||
message, | ||
model, | ||
...(temperature && { | ||
temperature: parseFloat(temperature), | ||
}), | ||
maxTokens, | ||
k, | ||
...(p && { | ||
p: parseFloat(p), | ||
}), | ||
stopSequences, | ||
...(frequencyPenalty && { | ||
frequencyPenalty: parseFloat(frequencyPenalty), | ||
}), | ||
})); | ||
|
||
$.export("$summary", `The message was successfully responded with ID \`${response.response_id}\``); | ||
return response; | ||
}, | ||
}; |
28 changes: 0 additions & 28 deletions
28
components/cohere_platform/actions/choose-best-completion/choose-best-completion.mjs
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.