Class LLMController
Controller for the REST API interface on LLM conversations.
Inheritance
LLMController
Assembly: WMServer.dll
Syntax
[Route("llm")]
[Authorize]
[ApiController]
public class LLMController : ControllerBase
Constructors
LLMController(WMAppDbContext)
Constructor that injects the database context.
Declaration
public LLMController(WMAppDbContext context)
Parameters
Methods
AssociateDocumentIndex(string, string)
Associate a VectorIndex and LLM for use in RAG
Declaration
[HttpPut("vectorindex/{documentIndexDir}/associate/{LLMDir}")]
public Task<IActionResult> AssociateDocumentIndex(string LLMDir, string documentIndexDir)
Parameters
Type |
Name |
Description |
string |
LLMDir |
The LLM ID
|
string |
documentIndexDir |
The VectorIndex ID
|
Returns
Clone(string, VersionCreateArgs?)
Creates a new version of the specified asset.
Declaration
[HttpPost("{id}/createVersion")]
public Task<ActionResult<IEnumerable<OpenDILLM>>> Clone(string id, VersionCreateArgs? args = null)
Parameters
Type |
Name |
Description |
string |
id |
The identifier of the asset
|
VersionCreateArgs |
args |
Arguments for creating the new version
|
Returns
Exceptions
CloneConnection(string, VersionCreateArgs?)
Creates a new version of the specified asset.
Declaration
[HttpPost("connection/{id}/createVersion")]
public Task<ActionResult<IEnumerable<OpenDILLMConnection>>> CloneConnection(string id, VersionCreateArgs? args = null)
Parameters
Type |
Name |
Description |
string |
id |
The identifier of the asset
|
VersionCreateArgs |
args |
Arguments for creating the new version
|
Returns
Exceptions
Commit(string)
Commits the specified asset to Head.
Declaration
[HttpPost("{id}/commitVersion")]
public Task<IActionResult> Commit(string id)
Parameters
Type |
Name |
Description |
string |
id |
The identifier of the asset
|
Returns
Exceptions
CommitConnection(string)
Commits the specified asset to Head.
Declaration
[HttpPost("connection/{id}/commitVersion")]
public Task<IActionResult> CommitConnection(string id)
Parameters
Type |
Name |
Description |
string |
id |
The identifier of the asset
|
Returns
Exceptions
Delete(string)
Delete an existing instance of a LLM
Declaration
[HttpDelete("{id}")]
public Task<IActionResult> Delete(string id)
Parameters
Type |
Name |
Description |
string |
id |
|
Returns
DeleteConnection(string)
Declaration
[HttpDelete("connection/{id}")]
public Task<IActionResult> DeleteConnection(string id)
Parameters
Type |
Name |
Description |
string |
id |
|
Returns
DeleteVectorDB(string)
Delete an existing instance of a Vector Index
Declaration
[HttpDelete("vectorindex/{id}")]
public Task<IActionResult> DeleteVectorDB(string id)
Parameters
Type |
Name |
Description |
string |
id |
The Vector Index ID
|
Returns
DisassociateDocumentIndex(string, string)
Disassociate a VectorIndex and LLM for use in RAG
Declaration
[HttpDelete("vectorindex/{documentIndexDir}/disassociate/{LLMDir}")]
public Task<IActionResult> DisassociateDocumentIndex(string LLMDir, string documentIndexDir)
Parameters
Type |
Name |
Description |
string |
LLMDir |
The LLM ID
|
string |
documentIndexDir |
The VectorIndex ID
|
Returns
EndConversation(string)
Ends the conversation given by the supplied ID.
Declaration
[HttpPut("/llmConversation/{id}/close")]
public Task<IActionResult> EndConversation(string id)
Parameters
Type |
Name |
Description |
string |
id |
The ID of the conversation to be ended.
|
Returns
Get()
Get the list of LLMs owned by the current user.
Declaration
[HttpGet]
public Task<ActionResult<IEnumerable<OpenDILLM>>> Get()
Returns
Get(string)
Get the LLM with the specified ID
Declaration
[HttpGet("{id}")]
public Task<ActionResult<OpenDILLM>> Get(string id)
Parameters
Type |
Name |
Description |
string |
id |
|
Returns
GetAPIKey(string)
Get the LLM with the specified ID's API Key
Declaration
[HttpGet("{id}/apikey")]
public Task<ActionResult<OpenDIDataSource>> GetAPIKey(string id)
Parameters
Type |
Name |
Description |
string |
id |
|
Returns
GetAPIKeyFromConnection(string)
Declaration
[HttpGet("connection/{id}/apikey")]
public Task<ActionResult<OpenDIDataSource>> GetAPIKeyFromConnection(string id)
Parameters
Type |
Name |
Description |
string |
id |
|
Returns
GetAssociatedVectorDBs(string)
Get all VectorDBs associated to the input LLM
Declaration
[HttpGet("vectorindex/associated/{id}")]
public Task<IActionResult> GetAssociatedVectorDBs(string id)
Parameters
Type |
Name |
Description |
string |
id |
The LLM ID
|
Returns
GetConnection()
Declaration
[HttpGet("connection")]
public Task<ActionResult<IEnumerable<OpenDILLMConnection>>> GetConnection()
Returns
GetConnection(string)
Declaration
[HttpGet("connection/{id}")]
public Task<ActionResult<OpenDILLMConnection>> GetConnection(string id)
Parameters
Type |
Name |
Description |
string |
id |
|
Returns
GetDocuments(string)
Get all of the documents associated with this vector index.
Declaration
[HttpGet("vectorindex/{id}/documents")]
public Task<IActionResult> GetDocuments(string id)
Parameters
Type |
Name |
Description |
string |
id |
The VectorIndex ID
|
Returns
GetVectorDB()
Declaration
[HttpGet("vectorindex")]
public Task<ActionResult<IEnumerable<OpenDIDocumentIndex>>> GetVectorDB()
Returns
GetVectorDB(string)
Get the Vector Index with the specified ID
Declaration
[HttpGet("vectorindex/{id}")]
public Task<ActionResult<OpenDIDocumentIndex>> GetVectorDB(string id)
Parameters
Type |
Name |
Description |
string |
id |
The Vector Index ID
|
Returns
Insert(string, string)
Insert a Document into the VectorIndex for indexing.
Declaration
[HttpPut("vectorindex/{documentIndexDir}/insert/{documentDir}")]
public Task<IActionResult> Insert(string documentIndexDir, string documentDir)
Parameters
Type |
Name |
Description |
string |
documentIndexDir |
The VectorIndex ID/DIr
|
string |
documentDir |
The Document ID/Dir
|
Returns
InsertMany(string, ManyDocumentArgs)
Inserts a set of Documents into the VectorIndex for indexing.
Declaration
[HttpPut("vectorindex/{documentIndexDir}/insertmany")]
public Task<IActionResult> InsertMany(string documentIndexDir, ManyDocumentArgs documentArgs)
Parameters
Type |
Name |
Description |
string |
documentIndexDir |
The VectorIndex ID/DIr
|
ManyDocumentArgs |
documentArgs |
The set of Document IDs/Dirs
|
Returns
Post(OpenDILLM)
Create a new instance of a LLM
Declaration
[HttpPost]
public Task<ActionResult<OpenDILLM>> Post(OpenDILLM openDI_m)
Parameters
Returns
PostConnection(OpenDILLMConnection)
Declaration
[HttpPost("connection")]
public Task<ActionResult<OpenDILLMConnection>> PostConnection(OpenDILLMConnection openDI_m)
Parameters
Returns
PostVectorDB(OpenDIDocumentIndex)
Create a new instance of a Vector Index
Declaration
[HttpPost("vectorindex")]
public Task<ActionResult<OpenDIDocumentIndex>> PostVectorDB(OpenDIDocumentIndex openDI_m)
Parameters
Returns
Put(string, OpenDILLM)
Update an existing instance of a LLM
Declaration
[HttpPut("{id}")]
public Task<IActionResult> Put(string id, OpenDILLM openDI_m)
Parameters
Returns
PutConnection(string, OpenDILLMConnection)
Declaration
[HttpPut("connection/{id}")]
public Task<IActionResult> PutConnection(string id, OpenDILLMConnection openDI_m)
Parameters
Returns
PutVectorDB(string, OpenDIDocumentIndex)
Update an existing instance of a Vector Index
Declaration
[HttpPut("vectorindex/{id}")]
public Task<IActionResult> PutVectorDB(string id, OpenDIDocumentIndex openDI_m)
Parameters
Returns
Query(string, MessageBody)
Query an LLM for contextually similar fragments stored in accessible vector indices.
Declaration
[HttpPut("vectorindex/query/{LLMID}")]
public Task<ActionResult<IEnumerable<string>>> Query(string LLMID, LLMController.MessageBody message)
Parameters
Returns
Remove(string, string)
Remove a document from the VectorIndex
Declaration
[HttpDelete("vectorindex/{documentIndexDir}/remove/{documentDir}")]
public Task<IActionResult> Remove(string documentIndexDir, string documentDir)
Parameters
Type |
Name |
Description |
string |
documentIndexDir |
The VectorIndex ID/DIr
|
string |
documentDir |
The Document ID/Dir
|
Returns
RemoveMany(string, ManyDocumentArgs)
Removes a set of documents from the VectorIndex
Declaration
[HttpDelete("vectorindex/{documentIndexDir}/removemany")]
public Task<IActionResult> RemoveMany(string documentIndexDir, ManyDocumentArgs documentArgs)
Parameters
Type |
Name |
Description |
string |
documentIndexDir |
The VectorIndex ID/DIr
|
ManyDocumentArgs |
documentArgs |
The set of Document IDs/Dirs
|
Returns
StreamConversation(ConversationArgs)
Utilizes a RAG architectured LLM to provide insights given the sent message, and message history.
Declaration
[HttpPost("/llmConversation")]
public Task StreamConversation(ConversationArgs args)
Parameters
Returns
Type |
Description |
Task |
A stream of response messages from the LLM provider
|
Versions(string)
Commits the specified asset to Head.
Declaration
[HttpPost("{id}/versions")]
public Task<ActionResult<IEnumerable<VersionArgs>>> Versions(string id)
Parameters
Type |
Name |
Description |
string |
id |
The identifier of the asset
|
Returns
Exceptions
VersionsConnection(string)
Commits the specified asset to Head.
Declaration
[HttpPost("connection/{id}/versions")]
public Task<ActionResult<IEnumerable<VersionArgs>>> VersionsConnection(string id)
Parameters
Type |
Name |
Description |
string |
id |
The identifier of the asset
|
Returns
Exceptions