mirror of
https://ghfast.top/https://github.com/discourse/discourse-ai.git
synced 2026-07-17 11:46:28 +08:00
This allows custom tools access to uploads and sophisticated searches using embedding.
It introduces:
- A shared front end for listing and uploading files (shared with personas)
- Backend implementation of index.search function within a custom tool.
Custom tools now may search through uploaded files
function invoke(params) {
return index.search(params.query)
}
This means that RAG implementers now may preload tools with knowledge and have high fidelity over
the search.
The search function support
specifying max results
specifying a subset of files to search (from uploads)
Also
- Improved documentation for tools (when creating a tool a preamble explains all the functionality)
- uploads were a bit finicky, fixed an edge case where the UI would not show them as updated
23 lines
516 B
Ruby
23 lines
516 B
Ruby
# frozen_string_literal: true
|
|
|
|
class AiCustomToolSerializer < ApplicationSerializer
|
|
attributes :id,
|
|
:name,
|
|
:description,
|
|
:summary,
|
|
:parameters,
|
|
:script,
|
|
:rag_chunk_tokens,
|
|
:rag_chunk_overlap_tokens,
|
|
:created_by_id,
|
|
:created_at,
|
|
:updated_at
|
|
|
|
self.root = "ai_tool"
|
|
|
|
has_many :rag_uploads, serializer: UploadSerializer, embed: :object
|
|
|
|
def rag_uploads
|
|
object.uploads
|
|
end
|
|
end
|