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์ ์๋ต์ ๋ฐ๋๋ค.
| Parameter | Type |
|---|---|
| api | PivotAIApi |
| query | string (opens in a new tab) |
| toolChoice | AIToolChoice |
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(๊ธฐ๋ณธ)์ด๋ฉด ์ถ๊ฐํ๋ค.
| Parameter | Type |
|---|---|
| tools | Array (opens in a new tab)<AIToolSchema> |
| clear | boolean (opens in a new tab) |
setDeveloperContext(context?): void (opens in a new tab)
๊ฐ๋ฐ์ ์ปจํ
์คํธ๋ฅผ ์ค์ ํ๋ค(๊ฐ๋ฐ์ ๊ด๋ จ ์ ๋ณด๊ฐ ํ์ํ ๋ ํธ์ถ ์ธก์์ ์ง์ ).
undefined๋ฅผ ์ ๋ฌํ๋ฉด ์ปจํ
์คํธ๋ฅผ ํด์ ํ๋ค.
| Parameter | Type |
|---|---|
| context | string (opens in a new tab) |
setSystemContext(context?): void (opens in a new tab)
์์คํ
์ปจํ
์คํธ๋ฅผ ์ค์ ํ๋ค(ํผ๋ฒ ๋ฐ์ดํฐยทํ๋๊ฐ ์ ํด์ง ๋ ํธ์ถ ์ธก์์ ์ง์ ).
undefined๋ฅผ ์ ๋ฌํ๋ฉด ์ปจํ
์คํธ๋ฅผ ํด์ ํ๋ค.
| Parameter | Type |
|---|---|
| context | string (opens in a new tab) |