API
API
AIRemoteModelImpl

AIRemoteModelImpl extends AIModelImpl

์›๊ฒฉ ์„œ๋ฒ„๋ฅผ ๊ฒฝ์œ ํ•˜์—ฌ LLM์„ ํ˜ธ์ถœํ•˜๋Š” AIRemoteModel ๊ตฌ์ฒด ๊ตฌํ˜„.
ํ†ต์‹ ์€ fetch๋กœ ์ง์ ‘ ์ˆ˜ํ–‰ํ•˜๋ฉฐ, ์™€์ด์–ด ํ”„๋กœํ† ์ฝœ์€ ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค:

  • ๋ช…๋ น ๋“ฑ๋ก: POST {url}/{commandsPath} ๋ณธ๋ฌธ { tools, clear } (tools๋Š” AICommand๋ฅผ JSONSchema tool ์ •์˜๋กœ ๋ณ€ํ™˜ํ•œ ๋ฐฐ์—ด)
  • ์ปจํ…์ŠคํŠธ ๋“ฑ๋ก: POST {url}/{contextPath} ๋ณธ๋ฌธ { systemContext, reasonInstruction } (tools์™€ ๋™์ผํ•˜๊ฒŒ ์„ธ์…˜์— ํ•œ ๋ฒˆ ๋“ฑ๋กํ•˜๋ฉฐ, ๋ณ€๊ฒฝ๋˜์—ˆ์„ ๋•Œ๋งŒ ๋‹ค์Œ ์งˆ์˜ ์ง์ „์— ์ „์†ก. reasonInstruction์€ message/๋„๊ตฌ๋ณ„ reason์˜ ์—ญํ•  ๊ณ„์•ฝ์œผ๋กœ, ์„œ๋ฒ„๊ฐ€ ํ”„๋กฌํ”„ํŠธ์— ์ฃผ์ž…ํ•œ๋‹ค)
  • ์งˆ์˜: POST {url}/{queryPath} ๋ณธ๋ฌธ { query } โ†’ ์‘๋‹ต ๋ณธ๋ฌธ์ด AIResponse
    ์‘๋‹ต์ด 2xx๊ฐ€ ์•„๋‹ˆ๊ฑฐ๋‚˜ ๋ณธ๋ฌธ parse์— ์‹คํŒจํ•˜๋ฉด ์˜ˆ์™ธ๋ฅผ throwํ•œ๋‹ค.
    ๋“ฑ๋ก๋œ ๋ช…๋ น์€ UI ํ‘œ์‹œ ๋“ฑ์„ ์œ„ํ•ด ๋กœ์ปฌ์—๋„ ์บ์‹œํ•˜๋ฉฐ(๋ฒ ์ด์Šค ์ฒ˜๋ฆฌ), ์„œ๋ฒ„ ๋“ฑ๋ก์ด ์„ฑ๊ณตํ•œ ๊ฒฝ์šฐ์—๋งŒ ๊ฐฑ์‹ ํ•œ๋‹ค.
    ์„œ๋ฒ„๊ฐ€ ์„ธ์…˜๋ณ„๋กœ tools/์ปจํ…์ŠคํŠธ๋ฅผ ๋ณด๊ด€ํ•œ๋‹ค๋Š” ์ „์ œ(stateful)์ด๋ฉฐ, ๋งค ์งˆ์˜์— ์ปจํ…์ŠคํŠธ๋ฅผ ์žฌ์ „์†กํ•˜์ง€ ์•Š๋Š”๋‹ค.

Properties

systemContext: string (opens in a new tab) readonly

ํ˜ธ์ถœ ์ธก(ํ”ผ๋ฒ—)์ด ์„ค์ •ํ•˜๋Š” ์‹œ์Šคํ…œ ์ปจํ…์ŠคํŠธ.
๋ฐ์ดํ„ฐ ํ•„๋“œ ๋ฉ”ํƒ€ยท๋™์ž‘ ์ง€์‹œ๋ฌธ ๋“ฑ์„ ๋‹ด์œผ๋ฉฐ, LLM ํ˜ธ์ถœ ์‹œ system ๋ฉ”์‹œ์ง€๋กœ ์‚ฌ์šฉ๋œ๋‹ค.

default: undefined

tools: Array (opens in a new tab)<AIToolSchema> readonly

๋ชจ๋ธ์— ๋“ฑ๋ก๋œ ๋„๊ตฌ ๋ชฉ๋ก.

default: undefined

Methods

call(api, query, toolChoice?): Promise (opens in a new tab)<AIConversationTurn>

์‚ฌ์šฉ์ž์˜ ์ž์—ฐ์–ด ์š”์ฒญ์„ ์ „๋‹ฌํ•˜๊ณ  LLM์˜ ์‘๋‹ต์„ ๋ฐ›๋Š”๋‹ค.

ParameterType
apiPivotAIApi
querystring (opens in a new tab)
toolChoiceAIToolChoice

dispose(): null

๊ฐ์ฒด๋ฅผ ํ•ด์ œํ•˜๊ณ  null์„ ๋ฐ˜ํ™˜ํ•œ๋‹ค.
์‚ฌ์šฉ ์˜ˆ: this._obj = this._obj.dispose();

returnย null

registerTools(tools, clear?): Promise (opens in a new tab)<void (opens in a new tab)>

๋ช…๋ น(๋„๊ตฌ) ๋ชฉ๋ก์„ ๋“ฑ๋กํ•œ๋‹ค.
์ „์†ก(_doRegisterTools)์ด ์„ฑ๊ณตํ•œ ๊ฒฝ์šฐ์—๋งŒ ๋กœ์ปฌ ์บ์‹œ๋ฅผ ๊ฐฑ์‹ ํ•œ๋‹ค.
clear๊ฐ€ true์ด๋ฉด ๊ธฐ์กด ๋ชฉ๋ก์„ ๋น„์šด ๋’ค ๋“ฑ๋กํ•˜๊ณ , false(๊ธฐ๋ณธ)์ด๋ฉด ์ถ”๊ฐ€ํ•œ๋‹ค.

ParameterType
toolsArray (opens in a new tab)<AIToolSchema>
clearboolean (opens in a new tab)

setDeveloperContext(context?): void (opens in a new tab)

๊ฐœ๋ฐœ์ž ์ปจํ…์ŠคํŠธ๋ฅผ ์„ค์ •ํ•œ๋‹ค(๊ฐœ๋ฐœ์ž ๊ด€๋ จ ์ •๋ณด๊ฐ€ ํ•„์š”ํ•  ๋•Œ ํ˜ธ์ถœ ์ธก์—์„œ ์ง€์ •).
undefined๋ฅผ ์ „๋‹ฌํ•˜๋ฉด ์ปจํ…์ŠคํŠธ๋ฅผ ํ•ด์ œํ•œ๋‹ค.

ParameterType
contextstring (opens in a new tab)

setSystemContext(context?): void (opens in a new tab)

์‹œ์Šคํ…œ ์ปจํ…์ŠคํŠธ๋ฅผ ์„ค์ •ํ•œ๋‹ค(ํ”ผ๋ฒ— ๋ฐ์ดํ„ฐยทํ•„๋“œ๊ฐ€ ์ •ํ•ด์งˆ ๋•Œ ํ˜ธ์ถœ ์ธก์—์„œ ์ง€์ •).
undefined๋ฅผ ์ „๋‹ฌํ•˜๋ฉด ์ปจํ…์ŠคํŠธ๋ฅผ ํ•ด์ œํ•œ๋‹ค.

ParameterType
contextstring (opens in a new tab)