mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 02:44:02 +00:00
fix(voice): offer typed chat the same Overpass tools as voice
Main now offers osm_query, and names it in the prompt, only when Overpass is configured. Typed chat follows the same switch on both providers: its prompt, the tools it offers and the calls it accepts.
This commit is contained in:
1 parent
fe78b3ebc9
commit
39165bb199
4 files changed
+59
-13
No files matched your search
@@ -4,6 +4,7 @@ import http from 'node:http';
|
||||
import { once } from 'node:events';
|
||||
import { createGeminiChatHandler } from '../server/providers/gemini/chat.js';
|
||||
import { createOpenAiChatHandler } from '../server/providers/openai/chat.js';
|
||||
import { GEV_REALTIME_TOOLS } from '../server/providers/openai/tools.js';
|
||||
import {
|
||||
realtimeDirectives,
|
||||
realtimeInstructions,
|
||||
@@ -514,6 +515,27 @@ for (const [name, provider] of Object.entries(providers)) {
|
||||
assert.equal((await (await unread.send()).json()).code, 'API_KEY_REJECTED');
|
||||
assert.equal(cancelled, true);
|
||||
});
|
||||
test(`${name} offers osm_query, and names it, only with Overpass, as voice does`, async (t) => {
|
||||
for (const overpass of [false, true]) {
|
||||
const f = await fixture(t, provider, undefined, {
|
||||
tools: GEV_REALTIME_TOOLS,
|
||||
overpassConfigured: () => overpass,
|
||||
});
|
||||
assert.equal((await f.send()).status, 200);
|
||||
const { body } = f.calls[0];
|
||||
const offered =
|
||||
name === 'openai'
|
||||
? body.tools.map((tool) => tool.function.name)
|
||||
: body.tools[0].functionDeclarations.map((tool) => tool.name);
|
||||
const prompt =
|
||||
name === 'openai'
|
||||
? body.messages[0].content
|
||||
: body.systemInstruction.parts[0].text;
|
||||
assert.equal(offered.includes('osm_query'), overpass);
|
||||
assert.equal(prompt.includes('osm_query'), overpass);
|
||||
assert.ok(offered.includes('resolve_area'));
|
||||
}
|
||||
});
|
||||
test(`${name} throttled replies say they are rate limited`, async (t) => {
|
||||
const local = await fixture(t, provider, undefined, {
|
||||
resolveRateLimit: () => '1',
|
||||
|
||||
Reference in new issue
Block a user