ide на основе vs code
Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Raw } from '@vscode/prompt-tsx';
import { CacheType } from '../../../platform/endpoint/common/endpointTypes';
const MaxCacheBreakpoints = 4;
/**
* Prompt cache breakpoint strategy:
*
* The prompt is structured like
* - System message
* - Custom instructions
* - Global context message (has prompt-tsx cache breakpoint)
* - History
* - Current user message with extra context
* - Current tool call rounds
*
* Below the current user message, we add cache breakpoints to the last tool result in each round.
* We add one to the current user message.
* And above the current user message, we add breakpoionts to an assistant message with no tool calls (so the terminal response in a turn).
*
* There will always be a cache miss when a new turn starts because the previous messages move from below the current user message with extra context to above it.
* For turns with no tool calling, we will have a hit on the previous assistant message in history.
* During the agentic loop, each request will have a hit on the previous tool result message.
*/
export function addCacheBreakpoints(messages: Raw.ChatMessage[], apiType: string | undefined) {
message messages
message apiType
messagecontent messagecontentpart parttype RawChatCompletionContentPartKindCacheBreakpoint
count MaxCacheBreakpoints messages
isBelowCurrentUserMessage
reversedMsgs messages
idx msg reversedMsgs
prevMsg reversedMsgsidx
hasCacheBreakpoint msgcontentpart parttype RawChatCompletionContentPartKindCacheBreakpoint
hasCacheBreakpoint
isLastToolResultInRound msgrole RawChatRoleTool prevMsgrole RawChatRoleTool
isAsstMsgWithNoTools msgrole RawChatRoleAssistant msgtoolCallslength
isBelowCurrentUserMessage isLastToolResultInRound msgrole RawChatRoleUser isAsstMsgWithNoTools msg apiType
count
msgcontent
type RawChatCompletionContentPartKindCacheBreakpoint
cacheType CacheType
count
msgrole RawChatRoleUser
isBelowCurrentUserMessage
msg messages
count
hasCacheBreakpoint msgcontentpart parttype RawChatCompletionContentPartKindCacheBreakpoint
msgrole RawChatRoleUser msgrole RawChatRoleSystem hasCacheBreakpoint msg apiType
count
msgcontent
type RawChatCompletionContentPartKindCacheBreakpoint
cacheType CacheType
msgrole RawChatRoleUser msgrole RawChatRoleSystem
message RawChatMessage apiType
apiType
messagerole RawChatRoleAssistant
messagecontentpart
parttype RawChatCompletionContentPartKindText
parttype RawChatCompletionContentPartKindImage
parttype RawChatCompletionContentPartKindDocument
part
messagecontentpart parttype RawChatCompletionContentPartKindText
parttype RawChatCompletionContentPartKindImage
parttype RawChatCompletionContentPartKindDocument
part
part RawChatCompletionContentPart supportedTypes
parttype RawChatCompletionContentPartKindOpaque partvalue partvalue partvalue
supportedTypespartvaluetype
messages RawChatMessage
count
msg messages
count msgcontentpart parttype RawChatCompletionContentPartKindCacheBreakpointlength
count