Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@fetchai/ai-engine-sdk
Advanced tools
AI Engine SDK JS/TS A library to enable users to build custom AI Engine Applications
npm install @fetchai/ai-engine-sdk
Before you start to integrate the AI Engine into your app, you might want to get familiar with agent functions.
To find out how to generate an apiKey
check out the documentation regarding Agentverse API keys.
import { AiEngine } from "@fetchai/ai-engine-sdk";
const aiEngine = new AiEngine(apiKey);
const functionGroups = await aiEngine.getFunctionGroups();
const functionGroupId = functionGroups.find((g) => g.name === "Fetch Verified");
If you would like to use the functions in your own My Functions function group instead then you can use this filter instead:
const functionGroupId = functionGroups.find((g) => g.name === "My Functions");
functionGroupId
fetched beforeconst session = await aiEngine.createSession(functionGroupId);
await session.start("Find a holiday destination");
You might want to query new messages regularly with a setTimeout
or setInterval
to check for new Message
(Check out examples/simple.ts for a complete example use case of the SDK):
const messages = await session.getMessages();
There are 5 different types of messages which are generated by the AI Engine and the SDK implements methods for checking the type of the respective new Message
:
isTaskSelectionMessage
- this message is generated for example in the case when the AI engine recommends functions based on the initial objective or in the case when the AI Engine finds multiple options to provide as an input for a function.isAiEngineMessage
- this message type doesn't expect the user to reply to, this is for notifying the user about somethingisConfirmationMessage
- when the AI Engine has managed to acquire all the inputs for the agent belonging to the to-be-executed function (= it has managed to build the context), it sends this type of message to the userisAgentMessage
- this is a regular question that the user has to reply to with a stringisStopMessage
- this is the message which is sent when the session has stopped and the AI Engine doesn't wait for any replies from the userAll message types (expect for the AI engine message and stop message) expect a response from the user and the SDK implements methods for sending reply in response to those different type of messages respectively.
The first argument of all these reply methods is the Message
object to which we want to send back the response.
The SDK methods you can use to reply to:
session.submitTaskSelection
session.submitResponse
session.submitConfirmation
or session.rejectConfirmation
- depending on if the user wants to confirm or reject the context generated by the AI engine respectivelyAfter finishing the conversation with AI Engine you can delete the session like this:
await session.delete();
If you would like to check out a complete example on how to integrate AI Engine into your app, feel free to checkout examples/simple.ts.
All contributions are welcome! Remember, contribution includes not only code, but any help with docs or issues raised by other developers. See our contribution guidelines for more details.
We use GitHub Issues for tracking requests and bugs, and GitHub Discussions for general questions and discussion.
FAQs
AI Engine SDK JS/TS A library to enable users to build custom AI Engine Applications
The npm package @fetchai/ai-engine-sdk receives a total of 3 weekly downloads. As such, @fetchai/ai-engine-sdk popularity was classified as not popular.
We found that @fetchai/ai-engine-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.