mirror of
https://github.com/voideditor/void
synced 2026-05-24 09:58:23 +00:00
misc
This commit is contained in:
parent
a98106072c
commit
995357710e
6 changed files with 13 additions and 15 deletions
|
|
@ -25,7 +25,7 @@ export type InternalToolInfo = {
|
|||
// helper
|
||||
const pagination = {
|
||||
desc: `Very large results may be paginated (indicated in the result). Pagination fails gracefully if out of bounds or invalid page number.`,
|
||||
param: { pageNumber: { type: 'number', description: 'The page number (optional, defaults to 1).' }, }
|
||||
param: { pageNumber: { type: 'number', description: 'The page number (optional, default is 1).' }, }
|
||||
} as const
|
||||
|
||||
export const contextTools = {
|
||||
|
|
@ -71,7 +71,7 @@ export const contextTools = {
|
|||
|
||||
} as const satisfies { [name: string]: InternalToolInfo }
|
||||
|
||||
type ContextToolName = keyof typeof contextTools
|
||||
export type ContextToolName = keyof typeof contextTools
|
||||
type ContextToolParamNames<T extends ContextToolName> = keyof typeof contextTools[T]['params']
|
||||
type ContextToolParams<T extends ContextToolName> = { [paramName in ContextToolParamNames<T>]: unknown }
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,6 @@ export const sendGroqChat: _InternalSendLLMChatMessageFnType = async ({ messages
|
|||
messages: messages,
|
||||
model: modelName,
|
||||
stream: true,
|
||||
// temperature: 0.7,
|
||||
// max_tokens: parseMaxTokensStr(thisConfig.maxTokens),
|
||||
})
|
||||
.then(async response => {
|
||||
_setAborter(() => response.controller.abort())
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@ export const sendMistralChat: _InternalSendLLMChatMessageFnType = async ({ messa
|
|||
messages: messages,
|
||||
model: modelName,
|
||||
stream: true,
|
||||
// temperature: 0.7,
|
||||
// maxTokens: 2048,
|
||||
})
|
||||
.then(async response => {
|
||||
// Mistral has a really nonstandard API - no interrupt and weird stream types
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
import OpenAI from 'openai';
|
||||
import { _InternalModelListFnType, _InternalSendLLMFIMMessageFnType, _InternalSendLLMChatMessageFnType } from '../../common/llmMessageTypes.js';
|
||||
import { Model } from 'openai/resources/models.js';
|
||||
import { contextTools, InternalToolInfo } from '../../common/toolsService.js';
|
||||
import { InternalToolInfo } from '../../common/toolsService.js';
|
||||
// import { parseMaxTokensStr } from './util.js';
|
||||
|
||||
|
||||
|
|
@ -141,7 +141,7 @@ export const sendOpenAIChat: _InternalSendLLMChatMessageFnType = ({ messages, on
|
|||
model: modelName,
|
||||
messages: messages,
|
||||
stream: true,
|
||||
tools: [toOpenAITool('list_dir', contextTools['list_dir'])],
|
||||
// tools: Object.keys(contextTools).map(name => toOpenAITool(name, contextTools[name as ContextToolName])),
|
||||
}
|
||||
|
||||
openai.chat.completions
|
||||
|
|
@ -150,8 +150,6 @@ export const sendOpenAIChat: _InternalSendLLMChatMessageFnType = ({ messages, on
|
|||
_setAborter(() => response.controller.abort())
|
||||
// when receive text
|
||||
for await (const chunk of response) {
|
||||
console.log('!!!', JSON.stringify(chunk, null, 2))
|
||||
|
||||
|
||||
let newText = ''
|
||||
newText += chunk.choices[0]?.delta?.tool_calls?.[0]?.function?.name ?? ''
|
||||
|
|
|
|||
|
|
@ -65,9 +65,14 @@ export const sendLLMMessage = ({
|
|||
|
||||
metricsService: IMetricsService
|
||||
) => {
|
||||
// messages.unshift({ role: 'system', content: aiInstructions })
|
||||
|
||||
const messagesArr = messagesType === 'chatMessages' ? cleanChatMessages(messages_) : []
|
||||
let messagesArr: _InternalLLMChatMessage[] = []
|
||||
if (messagesType === 'chatMessages') {
|
||||
messagesArr = cleanChatMessages([
|
||||
{ role: 'system', content: aiInstructions },
|
||||
...messages_
|
||||
])
|
||||
}
|
||||
|
||||
// only captures number of messages and message "shape", no actual code, instructions, prompts, etc
|
||||
const captureLLMEvent = (eventId: string, extras?: object) => {
|
||||
|
|
|
|||
|
|
@ -5,9 +5,8 @@ modelName -> {
|
|||
supports_tools: boolean // we will just do a string of tool use if it doesn't support
|
||||
supports_autocomplete_FIM (suffix) // we will just do a description of FIM if it doens't support <|fim_hole|>
|
||||
|
||||
supports_streaming: boolean (o1 does NOT)
|
||||
max_tokens: number
|
||||
|
||||
supports_streaming: boolean // (o1 does NOT) we will just dump the final result if doesn't support it
|
||||
max_tokens: number // required, DEFAULT is Infinity
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue