Skip to content

Commit

Permalink
Improve demo video recording in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
simonerom committed Jan 8, 2025
1 parent c244cdb commit c50076d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@
<details>
<summary>Read more</summary>
The QuickSilver framework empowers developers to build intelligent agents that:

- **Sense and Understand**: Use DePINs to collect and process data from decentralized physical infrastructure, acting as the sensory layer for AI agents.
- **Act and Respond**: Combine LLMs' advanced reasoning capabilities with data from DePINs to perform context-aware interactions.
- **Integrate Seamlessly**: Utilize the framework's modularity to connect with multiple DePIN projects, including weather, energy, and location networks, enabling agents to access diverse sources of decentralized data.
- **Orchestrate Workflows**: Automate multi-step processes while maintaining state and context.

</details>

---

<video src="./images/preview.mp4" autoplay loop muted playsinline width="800"></video>
![Preview](./images/preview.gif)

## Features

- **Workflow Orchestration**: Executes complex, multi-step tasks orchestrating interaction between LLM, tools, and memory.
Expand Down
21 changes: 12 additions & 9 deletions example/demo_agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Agent } from '../src/agent'; // Go up one level, then into src
import { SimpleMemory } from '../src/memory'; // Go up one level, then into src
import { Tool } from '../src/tools/api_tool'; // Go up one level, then into src/tools
import * as dotenv from 'dotenv';
import chalk from 'chalk'; // Import chalk for colored output

dotenv.config();

Expand All @@ -13,20 +14,20 @@ async function main() {

const apiKey = process.env.OPENAI_API_KEY;
if (!apiKey) {
console.error("Please set the OPENAI_API_KEY environment variable.");
console.error(chalk.red("Please set the OPENAI_API_KEY environment variable."));
return;
}
llm = new OpenAILLM(apiKey, "gpt-3.5-turbo"); // Use gpt-3.5-turbo for cost-effectiveness

const weatherApiKey = process.env.NUBILA_API_KEY;
if (!weatherApiKey) {
console.error("Please set the NUBILA_API_KEY environment variable.");
console.error(chalk.red("Please set the NUBILA_API_KEY environment variable."));
return;
}

const newsApiKey = process.env.NEWSAPI_API_KEY;
if (!newsApiKey) {
console.error("Please set the NEWSAPI_API_KEY environment variable.");
console.error(chalk.red("Please set the NEWSAPI_API_KEY environment variable."));
return;
}

Expand All @@ -46,20 +47,22 @@ async function main() {

// Create a function to handle user input recursively
const askQuestion = async () => {
rl.question('Enter your input (or "exit" to quit): ', async (input: string) => {
rl.question(chalk.cyan('Enter your input (or "exit" to quit): '), async (input: string) => {
if (input.toLowerCase() === 'exit') {
rl.close();
console.log(chalk.green("Goodbye!"));
return;
}

console.log(`User Input: ${input}`);
// console.log(chalk.blue(`User Input: ${input}`));
try {
const response = await agent.run(input);
console.log(`Binoai Response:\n${response}`);
console.log(chalk.cyan(`Agent Response:`));
console.log(chalk.yellow(response));
} catch (error) {
console.error("Binoai Error:", error);
console.error(chalk.red("Agent Error:"), error);
}
console.log("----");
console.log(chalk.gray("----"));

// Ask for next input
askQuestion();
Expand All @@ -72,4 +75,4 @@ async function main() {
// Move rl.close() to the exit condition above
}

main();
main();
Binary file added images/preview.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed images/preview.mp4
Binary file not shown.

0 comments on commit c50076d

Please sign in to comment.