Skip to content

Commit a2fe883

Browse files
committed
chore: Update Readme
1 parent 859efbe commit a2fe883

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

README.md

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ npm install @neuron.js/core
1919
Here's an example of creating a weather agent that fetches real-time weather data:
2020

2121
```javascript
22+
// 1. Create a Weather Tool
2223
import { Agent, Tool } from '@neuron.js/core';
23-
import 'dotenv/config'
2424

25-
// 1. Create a Weather Tool
2625
const weatherTool = new Tool(
2726
'weather_gov_query',
2827
'Fetches real-time weather data from an weather.gov.',
@@ -46,34 +45,18 @@ const weatherTool = new Tool(
4645
},
4746
},
4847
async (inputs, secrets) => {
49-
try {
50-
const response = await fetch(
51-
`https://api.weather.gov/points/${inputs.latitude},${inputs.longitude}`
52-
);
53-
const data = await response.json();
54-
const forecastResponse = await fetch(data.properties.forecast);
55-
const forecastData = await forecastResponse.json();
56-
return `Weather forecast in ${inputs.locationName} is ${forecastData.properties.periods[0].detailedForecast}`;
57-
} catch (error) {
58-
console.error('Error:', error);
59-
throw error;
60-
}
48+
// Implement fetching data from weather.gov.
6149
}
6250
)
6351

64-
// 2. Create a Weather Agent
52+
// 2. Build the agent
6553
const WeatherAgent = new Agent(
6654
'WeatherAgent',
6755
{
6856
persona: 'You are a cheerful and approachable virtual assistant dedicated to delivering accurate, concise, and engaging weather updates. Your tone is warm, lively, and always focused on making weather information easy to understand and fun to receive.',
6957
goal: 'Provide the current weather for a specified location as soon as the city or location details are provided. Your response should be both informative and conversational, ensuring clarity and usefulness for the user.',
7058
secrets: {
71-
OPEN_WEATHER_API_KEY: process.env.OPEN_WEATHER_API_KEY || '',
7259
OPENAI_API_KEY: process.env.OPENAI_API_KEY || ''
73-
},
74-
logger: {
75-
info: () => {},
76-
debug: () => {},
7760
}
7861
}
7962
)

0 commit comments

Comments
 (0)