Skip to content

Commit 5e95335

Browse files
committed
Adds prompt files to the project
1 parent 41c7f4f commit 5e95335

13 files changed

Lines changed: 319 additions & 0 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Add Gemini support to my Angular project's backend (Node.js).
2+
3+
Technical Stack:
4+
* Package: @google/genai (the new unified SDK)
5+
* Model: gemini-3-flash-preview
6+
7+
## Task:
8+
9+
1. Review my current server entry point and suggest how to initialize the GoogleGenAI client.
10+
11+
2. Outline a plan for a new POST endpoint that accepts a prompt and returns a generated response using the interactions API method. Ensure the plan explains how the interaction_id will be stored or passed back to the Angular client to maintain session state.
12+
13+
3. Verify that endpoint is working by building the app, and use `curl` to ensure that the endpoint is working.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Add communication from the client side app to the AI chat endpoint via the chat window in the web app.
2+
3+
Task:
4+
1. Review the endpoint and chat window code to understand where to integrate.
5+
6+
2. Outline a plan to implement the communication between the client and the server.
7+
- Use the **`@google/genai` interactions API**. Extract the generated message from the first text object in `interaction.outputs`. Refer to the documention if you get stuck: https://ai.google.dev/gemini-api/docs/interactions.md.txt
8+
9+
3. For verification:
10+
- build the app and confirm that the build is error free. Use the Angular MCP server tools.
11+
- you may also use the ChromeDevTools MCP server to preview the build in a browser
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Add function/tool calling support for our fleet by the interactions SDK so that natural language chats with the model can become actions.
2+
3+
## Task
4+
5+
1. **Review** the fleet-related functions in `src/server.ts` to identify candidates for tool calling.
6+
7+
2. **Implement Multi-Turn Tool Support**:
8+
- Use the **Interactions API** stateful mode with `previous_interaction_id`.
9+
- **Flat Tool Definition**: Ensure the `tools` array contains flat objects (sibling `type`, `name`, `description`, and `parameters`).
10+
- **Mandatory Schema**: Every tool MUST have a `parameters` schema, even if it is an empty object: `parameters: { type: 'object', properties: {} }`.
11+
- **Function Results**: For subsequent turns, provide `input` as an array of objects where `type: 'function_result'`, using `call_id` (matching the model's output `id`), and a JSON-serializable `result`.
12+
13+
3. **UI State Synchronization**:
14+
- Design a pattern using Angular **`resource`** to fetch data.
15+
- Use **`linkedSignal`** in components to manage local UI state that tracks the resource values.
16+
- Automatically trigger resource `.reload()` in `FleetService` whenever a chat interaction resolves, ensuring tool-call side effects are reflected in the UI.
17+
18+
4. **Verification**:
19+
- Build the app and confirm it is error-free using Angular MCP tools.
20+
- Use ChromeDevTools MCP to verify end-to-end functionality (e.g., adding a ticket via chat and seeing it appear in the UI).
21+
22+
## Implementation Reference (Ground Truth)
23+
24+
```typescript
25+
import { GoogleGenAI } from '@google/genai';
26+
const client = new GoogleGenAI({});
27+
28+
// 1. Tool Definition (Flat structure + Mandatory parameters)
29+
const tool = {
30+
type: 'function',
31+
name: 'get_status',
32+
description: 'Get current system status.',
33+
parameters: { type: 'object', properties: {} }
34+
};
35+
36+
// 2. Initial Request
37+
let interaction = await client.interactions.create({
38+
model: 'gemini-3-flash-preview',
39+
input: 'Status check.',
40+
tools: [tool]
41+
});
42+
43+
// 3. Multi-turn Orchestration Loop
44+
while (interaction.status === 'requires_action') {
45+
const outputs = interaction.outputs.filter(o => o.type === 'function_call');
46+
const results = outputs.map(call => ({
47+
type: 'function_result',
48+
name: call.name,
49+
call_id: call.id, // Critical mapping
50+
result: { data: 'All systems green' } // Must be JSON serializable
51+
}));
52+
53+
interaction = await client.interactions.create({
54+
model: 'gemini-3-flash-preview',
55+
previous_interaction_id: interaction.id,
56+
input: results,
57+
tools: [tool] // Re-specify tools on every turn
58+
});
59+
}
60+
```
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# I want to add support for gemini sdk to this angular app. Please update the server code to include the necessary changes. Once completed, pause for further instructions.
2+
3+
## Show me your plan before you make any changes so we can be on the same page
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Add Gemini support to my Angular project's backend (Node.js).
2+
3+
Technical Stack:
4+
* Package: @google/genai (the new unified SDK)
5+
* Model: gemini-3-flash-preview
6+
7+
## Task:
8+
9+
1. Review my current server entry point and suggest how to initialize the GoogleGenAI client.
10+
11+
2. Outline a plan for a new POST endpoint that accepts a prompt and returns a generated response using the interactions API method. Ensure the plan explains how the interaction_id will be stored or passed back to the Angular client to maintain session state.
12+
13+
3. Verify that endpoint is working by building the app, and use `curl` to ensure that the endpoint is working.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Please add the functionality to communicate from the client to the chat endpoint via the chat window. For this part, just return the messages and display the contents in the chat window. Use the Angular resource pattern.
2+
3+
## Show me your plan before you make any changes so we can be on the same page
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# I want to communicate from the client to the AI endpoint via the chat window in the web app.
2+
3+
* Tools: Angular SKills, Angular MCP, Google GenAI Skills
4+
5+
Task:
6+
1. Review the endpoint and chat window code to understand where to integrate.
7+
8+
2. Outline a plan to implement the communication between the client and the server.
9+
- Prefer the resource API for the client requests to the server.
10+
- Prefer the @google/genai interactions API on the server. Refer to the documention if you get stuck: https://ai.google.dev/gemini-api/docs/interactions.md.txt
11+
12+
3. For verification:
13+
- build the app and confirm that the build is error free. Use the Angular MCP server tools.
14+
- you may also use the ChromeDevTools MCP server to preview the build in a browser
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Add communication from the client side app to the AI chat endpoint via the chat window in the web app.
2+
3+
Task:
4+
1. Review the endpoint and chat window code to understand where to integrate.
5+
6+
2. Outline a plan to implement the communication between the client and the server.
7+
- Use the **`@google/genai` interactions API**. Extract the generated message from the first text object in `interaction.outputs`. Refer to the documention if you get stuck: https://ai.google.dev/gemini-api/docs/interactions.md.txt
8+
9+
3. For verification:
10+
- build the app and confirm that the build is error free. Use the Angular MCP server tools.
11+
- you may also use the ChromeDevTools MCP server to preview the build in a browser
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Let's add tool calling support for our fleet. Have a look at the functions in the Server file to know what can be called and how. Be sure to handle recursive tool calls and responses from Gemini. Use the Gemini SDK skills for help on syntax and best practices where needed.
2+
3+
## Show me your plan before you make any changes so we can be on the same page
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# I want to add function/tool calling support for our fleet by the interactions SDK so that natural language chats with the model can become actions.
2+
3+
* Tools:
4+
- Agent Skills:
5+
- `angular-developer`
6+
- `gemini-api-dev`
7+
- `gemini-interactions-api`
8+
- MCP Servers:
9+
- Angular MCP
10+
- ChromeDevTools MCP
11+
12+
## Task
13+
14+
1. Review the Fleet related functions in the `server.ts` file to know what can be called and how to call them.
15+
16+
2. Outline a plan to implement this feature.
17+
- Be sure to handle multi-turn tool calls and responses from the interactions API. Use the Gemini SDK skills for help on syntax and best practices where needed. Refer to the documention if you get stuck: https://ai.google.dev/gemini-api/docs/interactions.md.txt
18+
19+
- Make a plan for a communication pattern with the UI so that the response from a tool call can create a "state" update on the UI. For example, if the user requests to add vehicles to the repair queue, the server will have an updated state, but the UI will be out of sync. Design a pattern using Angular resource to fetch data and a linkedSignal to manage the local UI state. When a tool call (e.g., add_to_repair_queue) succeeds, the linkedSignal must automatically reflect the updated fleet status from the server response.
20+
21+
- Ensure the **`tools` array** uses the new format (an array of objects with `type: 'function'`).
22+
23+
- **CRITICAL FIX**: For the **`input` on subsequent turns**, provide an array of objects where `type: 'function_result'` and the `result` field is always a **JSON-serializable object** (wrap arrays in `{ data: [...] }`). Do NOT wrap the array in a `role`/`parts` object.
24+
25+
3. For verification:
26+
- build the app and confirm that the build is error free. Use the Angular MCP server tools.
27+
- you may also use the ChromeDevTools MCP server to preview the build in a browser

0 commit comments

Comments
 (0)