llamaindex
Enumerations
- ClipEmbeddingModelType
- DeuceChatStrategy
- HuggingFaceEmbeddingModelType
- IndexStructType
- KeywordTableRetrieverMode
- MetadataMode
- MistralAIEmbeddingModelType
- NodeRelationship
- ObjectType
- OpenAIEmbeddingModelType
- SimilarityType
- SummaryRetrieverMode
- Tokenizers
- VectorStoreQueryMode
Classes
- Anthropic
- AstraDBVectorStore
- AudioSubtitlesReader
- AudioTranscriptParagraphsReader
- AudioTranscriptReader
- AudioTranscriptSentencesReader
- BaseDocumentStore
- BaseEmbedding
- BaseInMemoryKVStore
- BaseIndex
- BaseIndexStore
- BaseKVStore
- BaseNode
- CallbackManager
- ClipEmbedding
- CompactAndRefine
- CondenseQuestionChatEngine
- ContextChatEngine
- DefaultContextGenerator
- Document
- HTMLReader
- HistoryChatEngine
- HuggingFaceEmbedding
- ImageDocument
- ImageNode
- InMemoryFileSystem
- IndexDict
- IndexList
- IndexNode
- IndexStruct
- KeywordTable
- KeywordTableIndex
- KeywordTableLLMRetriever
- KeywordTableRAKERetriever
- KeywordTableSimpleRetriever
- LLMQuestionGenerator
- LlamaDeuce
- MarkdownReader
- MetadataReplacementPostProcessor
- MistralAI
- MistralAIEmbedding
- MistralAISession
- MongoDBAtlasVectorSearch
- MultiModalEmbedding
- MultiModalResponseSynthesizer
- NotionReader
- Ollama
- OpenAI
- OpenAIEmbedding
- PDFReader
- PGVectorStore
- PapaCSVReader
- PineconeVectorStore
- Portkey
- PromptHelper
- Refine
- Response
- ResponseSynthesizer
- RetrieverQueryEngine
- SentenceSplitter
- SentenceWindowNodeParser
- SimilarityPostprocessor
- SimpleChatEngine
- SimpleChatHistory
- SimpleDirectoryReader
- SimpleDocumentStore
- SimpleIndexStore
- SimpleKVStore
- SimpleMongoReader
- SimpleNodeParser
- SimpleResponseBuilder
- SimpleVectorStore
- SubQuestionOutputParser
- SubQuestionQueryEngine
- SummaryChatHistory
- SummaryIndex
- SummaryIndexLLMRetriever
- SummaryIndexRetriever
- TextFileReader
- TextNode
- TreeSummarize
- VectorIndexRetriever
- VectorStoreIndex
Interfaces
- BaseIndexInit
- BaseNodePostprocessor
- BaseOutputParser
- BaseQueryEngine
- BaseQuestionGenerator
- BaseReader
- BaseResponseBuilder
- BaseRetriever
- BaseSynthesizer
- BaseTool
- ChatEngine
- ChatHistory
- ChatMessage
- ChatResponse
- Context
- ContextGenerator
- DefaultStreamToken
- Event
- ExactMatchFilter
- GenericFileSystem
- LLM
- LLMMetadata
- MessageContentDetail
- MetadataFilters
- MetadataInfo
- NodeParser
- NodeWithScore
- QueryEngineTool
- RefDocInfo
- RelatedNodeInfo
- RetrievalCallbackResponse
- ServiceContext
- ServiceContextOptions
- StorageContext
- StreamCallbackResponse
- StructuredOutput
- SubQuestion
- ToolMetadata
- VectorStore
- VectorStoreInfo
- VectorStoreQuery
- VectorStoreQueryResult
- VectorStoreQuerySpec
- WalkableFileSystem
Type Aliases
AnthropicStreamToken
Ƭ AnthropicStreamToken: Object
Type declaration
Name | Type |
---|---|
completion | string |
log_id? | string |
model | string |
stop? | boolean |
stop_reason | string | undefined |
Defined in
packages/core/src/callbacks/CallbackManager.ts:42
AssemblyAIOptions
Ƭ AssemblyAIOptions: Partial
<BaseServiceParams
>
Defined in
packages/core/src/readers/AssemblyAI.ts:12
ChoiceSelectPrompt
Ƭ ChoiceSelectPrompt: typeof defaultChoiceSelectPrompt
Defined in
packages/core/src/Prompt.ts:165
CompleteFileSystem
Ƭ CompleteFileSystem: GenericFileSystem
& WalkableFileSystem
Defined in
packages/core/src/storage/FileSystem.ts:49
CompletionResponse
Ƭ CompletionResponse: ChatResponse
Defined in
packages/core/src/llm/LLM.ts:52
CondenseQuestionPrompt
Ƭ CondenseQuestionPrompt: typeof defaultCondenseQuestionPrompt
Defined in
packages/core/src/Prompt.ts:346
ContextSystemPrompt
Ƭ ContextSystemPrompt: typeof defaultContextSystemPrompt
Defined in
packages/core/src/Prompt.ts:367
EventTag
Ƭ EventTag: "intermediate"
| "final"
Defined in
packages/core/src/callbacks/CallbackManager.ts:10
EventType
Ƭ EventType: "retrieve"
| "llmPredict"
| "wrapper"
Defined in
packages/core/src/callbacks/CallbackManager.ts:11
ImageNodeConstructorProps
Ƭ ImageNodeConstructorProps<T
>: Pick
<ImageNode
<T
>, "image"
| "id_"
> & Partial
<ImageNode
<T
>>
Type parameters
Name | Type |
---|---|
T | extends Metadata |
Defined in
ImageType
Ƭ ImageType: string
| Blob
| URL
Defined in
KeywordExtractPrompt
Ƭ KeywordExtractPrompt: typeof defaultKeywordExtractPrompt
Defined in
packages/core/src/Prompt.ts:382
ListIndex
Ƭ ListIndex: SummaryIndex
Defined in
packages/core/src/indices/summary/SummaryIndex.ts:266
ListIndexLLMRetriever
Ƭ ListIndexLLMRetriever: SummaryIndexLLMRetriever
Defined in
packages/core/src/indices/summary/SummaryIndexRetriever.ts:134
ListIndexRetriever
Ƭ ListIndexRetriever: SummaryIndexRetriever
Defined in
packages/core/src/indices/summary/SummaryIndexRetriever.ts:133
ListRetrieverMode
Ƭ ListRetrieverMode: SummaryRetrieverMode
Defined in
packages/core/src/indices/summary/SummaryIndex.ts:267
MessageContent
Ƭ MessageContent: string
| MessageContentDetail
[]
Extended type for the content of a message that allows for multi-modal messages.
Defined in
packages/core/src/ChatEngine.ts:350
MessageType
Ƭ MessageType: "user"
| "assistant"
| "system"
| "generic"
| "function"
| "memory"
Defined in
packages/core/src/llm/LLM.ts:32
Metadata
Ƭ Metadata: Record
<string
, any
>
Defined in
OpenAIStreamToken
Ƭ OpenAIStreamToken: DefaultStreamToken
Defined in
packages/core/src/callbacks/CallbackManager.ts:41
QueryKeywordExtractPrompt
Ƭ QueryKeywordExtractPrompt: typeof defaultQueryKeywordExtractPrompt
Defined in
packages/core/src/Prompt.ts:398
RefinePrompt
Ƭ RefinePrompt: typeof defaultRefinePrompt
Defined in
packages/core/src/Prompt.ts:106
RelatedNodeType
Ƭ RelatedNodeType<T
>: RelatedNodeInfo
<T
> | RelatedNodeInfo
<T
>[]
Type parameters
Name | Type |
---|---|
T | extends Metadata = Metadata |
Defined in
SimpleDirectoryReaderLoadDataProps
Ƭ SimpleDirectoryReaderLoadDataProps: Object
Type declaration
Name | Type |
---|---|
defaultReader? | BaseReader | null |
directoryPath | string |
fileExtToReader? | Record <string , BaseReader > |
fs? | CompleteFileSystem |
Defined in
packages/core/src/readers/SimpleDirectoryReader.ts:52
SimplePrompt
Ƭ SimplePrompt: (input
: Record
<string
, string
| undefined
>) => string
Type declaration
▸ (input
): string
A SimplePrompt is a function that takes a dictionary of inputs and returns a string. NOTE this is a different interface compared to LlamaIndex Python NOTE 2: we default to empty string to make it easy to calculate prompt sizes
Parameters
Name | Type |
---|---|
input | Record <string , string | undefined > |
Returns
string
Defined in
packages/core/src/Prompt.ts:10
SubQuestionPrompt
Ƭ SubQuestionPrompt: typeof defaultSubQuestionPrompt
Defined in
packages/core/src/Prompt.ts:314
SubtitleFormat
Ƭ SubtitleFormat: "srt"
| "vtt"
Description
Format of the subtitles
Defined in
node_modules/.pnpm/assemblyai@4.0.0/node_modules/assemblyai/dist/types/openapi.generated.d.ts:309
SummaryPrompt
Ƭ SummaryPrompt: typeof defaultSummaryPrompt
Defined in
packages/core/src/Prompt.ts:73
TextQaPrompt
Ƭ TextQaPrompt: typeof defaultTextQaPrompt
Defined in
packages/core/src/Prompt.ts:37
TranscribeParams
Ƭ TranscribeParams: { audio
: AudioToTranscribe
} & Omit
<TranscriptParams
, "audio_url"
>
The parameters to transcribe an audio file.
Defined in
node_modules/.pnpm/assemblyai@4.0.0/node_modules/assemblyai/dist/types/transcripts/index.d.ts:29
TreeSummarizePrompt
Ƭ TreeSummarizePrompt: typeof defaultTreeSummarizePrompt
Defined in
packages/core/src/Prompt.ts:131
Variables
ALL_AVAILABLE_ANTHROPIC_MODELS
• Const
ALL_AVAILABLE_ANTHROPIC_MODELS: Object
Type declaration
Name | Type |
---|---|
claude-2 | { contextWindow : number = 200000 } |
claude-2.contextWindow | number |
claude-instant-1 | { contextWindow : number = 100000 } |
claude-instant-1.contextWindow | number |
Defined in
packages/core/src/llm/LLM.ts:643
ALL_AVAILABLE_LLAMADEUCE_MODELS
• Const
ALL_AVAILABLE_LLAMADEUCE_MODELS: Object
Type declaration
Name | Type |
---|---|
Llama-2-13b-chat-4bit | { contextWindow : number = 4096; replicateApi : string = "meta/llama-2-13b-chat:f4e2de70d66816a838a89eeeb621910adffb0dd0baba3976c96980970978018d" } |
Llama-2-13b-chat-4bit.contextWindow | number |
Llama-2-13b-chat-4bit.replicateApi | string |
Llama-2-13b-chat-old | { contextWindow : number = 4096; replicateApi : string = "a16z-infra/llama13b-v2-chat:df7690f1994d94e96ad9d568eac121aecf50684a0b0963b25a41cc40061269e5" } |
Llama-2-13b-chat-old.contextWindow | number |
Llama-2-13b-chat-old.replicateApi | string |
Llama-2-70b-chat-4bit | { contextWindow : number = 4096; replicateApi : string = "meta/llama-2-70b-chat:02e509c789964a7ea8736978a43525956ef40397be9033abf9fd2badfe68c9e3" } |
Llama-2-70b-chat-4bit.contextWindow | number |
Llama-2-70b-chat-4bit.replicateApi | string |
Llama-2-70b-chat-old | { contextWindow : number = 4096; replicateApi : string = "replicate/llama70b-v2-chat:e951f18578850b652510200860fc4ea62b3b16fac280f83ff32282f87bbd2e48" } |
Llama-2-70b-chat-old.contextWindow | number |
Llama-2-70b-chat-old.replicateApi | string |
Llama-2-7b-chat-4bit | { contextWindow : number = 4096; replicateApi : string = "meta/llama-2-7b-chat:13c3cdee13ee059ab779f0291d29054dab00a47dad8261375654de5540165fb0" } |
Llama-2-7b-chat-4bit.contextWindow | number |
Llama-2-7b-chat-4bit.replicateApi | string |
Llama-2-7b-chat-old | { contextWindow : number = 4096; replicateApi : string = "a16z-infra/llama7b-v2-chat:4f0a4744c7295c024a1de15e1a63c880d3da035fa1f49bfd344fe076074c8eea" } |
Llama-2-7b-chat-old.contextWindow | number |
Llama-2-7b-chat-old.replicateApi | string |
Defined in
packages/core/src/llm/LLM.ts:373
ALL_AVAILABLE_MISTRAL_MODELS
• Const
ALL_AVAILABLE_MISTRAL_MODELS: Object
Type declaration
Name | Type |
---|---|
mistral-medium | { contextWindow : number = 32000 } |
mistral-medium.contextWindow | number |
mistral-small | { contextWindow : number = 32000 } |
mistral-small.contextWindow | number |
mistral-tiny | { contextWindow : number = 32000 } |
mistral-tiny.contextWindow | number |
Defined in
packages/core/src/llm/mistral.ts:9
ALL_AVAILABLE_OPENAI_MODELS
• Const
ALL_AVAILABLE_OPENAI_MODELS: Object
We currently support GPT-3.5 and GPT-4 models
Type declaration
Name | Type |
---|---|
gpt-3.5-turbo | { contextWindow : number = 4096 } |
gpt-3.5-turbo.contextWindow | number |
gpt-3.5-turbo-1106 | { contextWindow : number = 16384 } |
gpt-3.5-turbo-1106.contextWindow | number |
gpt-3.5-turbo-16k | { contextWindow : number = 16384 } |
gpt-3.5-turbo-16k.contextWindow | number |
gpt-4 | { contextWindow : number = 8192 } |
gpt-4.contextWindow | number |
gpt-4-1106-preview | { contextWindow : number = 128000 } |
gpt-4-1106-preview.contextWindow | number |
gpt-4-32k | { contextWindow : number = 32768 } |
gpt-4-32k.contextWindow | number |
gpt-4-vision-preview | { contextWindow : number = 8192 } |
gpt-4-vision-preview.contextWindow | number |
Defined in
packages/core/src/llm/LLM.ts:120
DEFAULT_CHUNK_OVERLAP
• Const
DEFAULT_CHUNK_OVERLAP: 20
Defined in
packages/core/src/constants.ts:5
DEFAULT_CHUNK_OVERLAP_RATIO
• Const
DEFAULT_CHUNK_OVERLAP_RATIO: 0.1
Defined in
packages/core/src/constants.ts:6
DEFAULT_CHUNK_SIZE
• Const
DEFAULT_CHUNK_SIZE: 1024
Defined in
packages/core/src/constants.ts:4
DEFAULT_COLLECTION
• Const
DEFAULT_COLLECTION: "data"
Defined in
packages/core/src/storage/constants.ts:1
DEFAULT_CONTEXT_WINDOW
• Const
DEFAULT_CONTEXT_WINDOW: 3900
Defined in
packages/core/src/constants.ts:1
DEFAULT_DOC_STORE_PERSIST_FILENAME
• Const
DEFAULT_DOC_STORE_PERSIST_FILENAME: "doc_store.json"
Defined in
packages/core/src/storage/constants.ts:4
DEFAULT_EMBEDDING_DIM
• Const
DEFAULT_EMBEDDING_DIM: 1536
Defined in
packages/core/src/constants.ts:10
DEFAULT_FS
• Const
DEFAULT_FS: GenericFileSystem
| CompleteFileSystem
Defined in
packages/core/src/storage/FileSystem.ts:62
DEFAULT_GRAPH_STORE_PERSIST_FILENAME
• Const
DEFAULT_GRAPH_STORE_PERSIST_FILENAME: "graph_store.json"
Defined in
packages/core/src/storage/constants.ts:6
DEFAULT_IMAGE_VECTOR_NAMESPACE
• Const
DEFAULT_IMAGE_VECTOR_NAMESPACE: "images"
Defined in
packages/core/src/storage/constants.ts:8
DEFAULT_INDEX_STORE_PERSIST_FILENAME
• Const
DEFAULT_INDEX_STORE_PERSIST_FILENAME: "index_store.json"
Defined in
packages/core/src/storage/constants.ts:3
DEFAULT_NAMESPACE
• Const
DEFAULT_NAMESPACE: "docstore"
Defined in
packages/core/src/storage/constants.ts:7
DEFAULT_NUM_OUTPUTS
• Const
DEFAULT_NUM_OUTPUTS: 256
Defined in
packages/core/src/constants.ts:2
DEFAULT_OG_TEXT_METADATA_KEY
• Const
DEFAULT_OG_TEXT_METADATA_KEY: "original_text"
Defined in
packages/core/src/nodeParsers/SentenceWindowNodeParser.ts:8
DEFAULT_PADDING
• Const
DEFAULT_PADDING: 5
Defined in
packages/core/src/constants.ts:11
DEFAULT_PERSIST_DIR
• Const
DEFAULT_PERSIST_DIR: "./storage"
Defined in
packages/core/src/storage/constants.ts:2
DEFAULT_SIMILARITY_TOP_K
• Const
DEFAULT_SIMILARITY_TOP_K: 2
Defined in
packages/core/src/constants.ts:7
DEFAULT_VECTOR_STORE_PERSIST_FILENAME
• Const
DEFAULT_VECTOR_STORE_PERSIST_FILENAME: "vector_store.json"
Defined in
packages/core/src/storage/constants.ts:5
DEFAULT_WINDOW_METADATA_KEY
• Const
DEFAULT_WINDOW_METADATA_KEY: "window"
Defined in
packages/core/src/nodeParsers/SentenceWindowNodeParser.ts:7
DEFAULT_WINDOW_SIZE
• Const
DEFAULT_WINDOW_SIZE: 3
Defined in
packages/core/src/nodeParsers/SentenceWindowNodeParser.ts:6
FILE_EXT_TO_READER
• Const
FILE_EXT_TO_READER: Record
<string
, BaseReader
>
Defined in
packages/core/src/readers/SimpleDirectoryReader.ts:38
GPT35_MODELS
• Const
GPT35_MODELS: Object
Type declaration
Name | Type |
---|---|
gpt-3.5-turbo | { contextWindow : number = 4096 } |
gpt-3.5-turbo.contextWindow | number |
gpt-3.5-turbo-1106 | { contextWindow : number = 16384 } |
gpt-3.5-turbo-1106.contextWindow | number |
gpt-3.5-turbo-16k | { contextWindow : number = 16384 } |
gpt-3.5-turbo-16k.contextWindow | number |
Defined in
packages/core/src/llm/LLM.ts:111
GPT4_MODELS
• Const
GPT4_MODELS: Object
Type declaration
Name | Type |
---|---|
gpt-4 | { contextWindow : number = 8192 } |
gpt-4.contextWindow | number |
gpt-4-1106-preview | { contextWindow : number = 128000 } |
gpt-4-1106-preview.contextWindow | number |
gpt-4-32k | { contextWindow : number = 32768 } |
gpt-4-32k.contextWindow | number |
gpt-4-vision-preview | { contextWindow : number = 8192 } |
gpt-4-vision-preview.contextWindow | number |
Defined in
packages/core/src/llm/LLM.ts:104
defaultParagraphSeparator
• Const
defaultParagraphSeparator: string
Defined in
packages/core/src/TextSplitter.ts:53
globalsHelper
• Const
globalsHelper: GlobalsHelper
Defined in
packages/core/src/GlobalsHelper.ts:76
Functions
anthropicTextQaPrompt
▸ anthropicTextQaPrompt(«destructured»
): string
Parameters
Name | Type |
---|---|
«destructured» | Object |
Returns
string
Defined in
packages/core/src/Prompt.ts:39
buildToolsText
▸ buildToolsText(tools
): string
Parameters
Name | Type |
---|---|
tools | ToolMetadata [] |
Returns
string
Defined in
packages/core/src/Prompt.ts:243
cjkSentenceTokenizer
▸ cjkSentenceTokenizer(sentence
): string
[]
Tokenizes sentences. Suitable for Chinese, Japanese, and Korean. Use instead of defaultSentenceTokenizer
.
Parameters
Name | Type |
---|---|
sentence | string |
Returns
string
[]
string[]
Defined in
packages/core/src/TextSplitter.ts:37
defaultChoiceSelectPrompt
▸ defaultChoiceSelectPrompt(«destructured»
): string
Parameters
Name | Type |
---|---|
«destructured» | Object |
Returns
string
Defined in
packages/core/src/Prompt.ts:133
defaultCondenseQuestionPrompt
▸ defaultCondenseQuestionPrompt(«destructured»
): string
Parameters
Name | Type |
---|---|
«destructured» | Object |
Returns
string
Defined in
packages/core/src/Prompt.ts:330
defaultContextSystemPrompt
▸ defaultContextSystemPrompt(«destructured»
): string
Parameters
Name | Type |
---|---|
«destructured» | Object |
Returns
string
Defined in
packages/core/src/Prompt.ts:360
defaultKeywordExtractPrompt
▸ defaultKeywordExtractPrompt(«destructured»
): string
Parameters
Name | Type |
---|---|
«destructured» | Object |
Returns
string
Defined in
packages/core/src/Prompt.ts:369
defaultQueryKeywordExtractPrompt
▸ defaultQueryKeywordExtractPrompt(«destructured»
): string
Parameters
Name | Type |
---|---|
«destructured» | Object |
Returns
string
Defined in
packages/core/src/Prompt.ts:384
defaultRefinePrompt
▸ defaultRefinePrompt(«destructured»
): string
Parameters
Name | Type |
---|---|
«destructured» | Object |
Returns
string
Defined in
packages/core/src/Prompt.ts:91
defaultSentenceTokenizer
▸ defaultSentenceTokenizer(text
): string
[]
Parameters
Name | Type |
---|---|
text | string |
Returns
string
[]
Defined in
packages/core/src/TextSplitter.ts:22
defaultSubQuestionPrompt
▸ defaultSubQuestionPrompt(«destructured»
): string
Parameters
Name | Type |
---|---|
«destructured» | Object |
Returns
string
Defined in
packages/core/src/Prompt.ts:284
defaultSummaryPrompt
▸ defaultSummaryPrompt(«destructured»
): string
Parameters
Name | Type |
---|---|
«destructured» | Object |
Returns
string
Defined in
packages/core/src/Prompt.ts:62
defaultTextQaPrompt
▸ defaultTextQaPrompt(«destructured»
): string
Parameters
Name | Type |
---|---|
«destructured» | Object |
Returns
string
Defined in
packages/core/src/Prompt.ts:27
defaultTreeSummarizePrompt
▸ defaultTreeSummarizePrompt(«destructured»
): string
Parameters
Name | Type |
---|---|
«destructured» | Object |
Returns
string
Defined in
packages/core/src/Prompt.ts:121
exists
▸ exists(fs
, path
): Promise
<boolean
>
Checks if a file exists. Analogous to the os.path.exists function from Python.
Parameters
Name | Type | Description |
---|---|---|
fs | GenericFileSystem | The filesystem to use. |
path | string | The path to the file to check. |
Returns
Promise
<boolean
>
A promise that resolves to true if the file exists, false otherwise.
Defined in
packages/core/src/storage/FileSystem.ts:74
getBiggestPrompt
▸ getBiggestPrompt(prompts
): SimplePrompt
Get biggest empty prompt size from a list of prompts. Used to calculate the maximum size of inputs to the LLM.
Parameters
Name | Type |
---|---|
prompts | SimplePrompt [] |
Returns
Defined in
packages/core/src/PromptHelper.ts:21
getEmptyPromptTxt
▸ getEmptyPromptTxt(prompt
): string
Parameters
Name | Type |
---|---|
prompt | SimplePrompt |
Returns
string
Defined in
packages/core/src/PromptHelper.ts:11
getNodeFS
▸ getNodeFS(): CompleteFileSystem
Returns
Defined in
packages/core/src/storage/FileSystem.ts:51
getResponseBuilder
▸ getResponseBuilder(serviceContext
, responseMode?
): BaseResponseBuilder
Parameters
Name | Type |
---|---|
serviceContext | ServiceContext |
responseMode? | ResponseMode |
Returns
Defined in
packages/core/src/synthesizers/builders.ts:269
getTopKEmbeddings
▸ getTopKEmbeddings(queryEmbedding
, embeddings
, similarityTopK?
, embeddingIds?
, similarityCutoff?
): [number
[], any
[]]
Get the top K embeddings from a list of embeddings ordered by similarity to the query.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
queryEmbedding | number [] | undefined | |
embeddings | number [][] | undefined | list of embeddings to consider |
similarityTopK | number | DEFAULT_SIMILARITY_TOP_K | max number of embeddings to return, default 2 |
embeddingIds | null | any [] | null | ids of embeddings in the embeddings list |
similarityCutoff | null | number | null | minimum similarity score |
Returns
[number
[], any
[]]
Defined in
packages/core/src/embeddings/utils.ts:69
getTopKEmbeddingsLearner
▸ getTopKEmbeddingsLearner(queryEmbedding
, embeddings
, similarityTopK?
, embeddingsIds?
, queryMode?
): [number
[], any
[]]
Parameters
Name | Type | Default value |
---|---|---|
queryEmbedding | number [] | undefined |
embeddings | number [][] | undefined |
similarityTopK? | number | undefined |
embeddingsIds? | any [] | undefined |
queryMode | VectorStoreQueryMode | VectorStoreQueryMode.SVM |
Returns
[number
[], any
[]]
Defined in
packages/core/src/embeddings/utils.ts:111
getTopKMMREmbeddings
▸ getTopKMMREmbeddings(queryEmbedding
, embeddings
, similarityFn?
, similarityTopK?
, embeddingIds?
, _similarityCutoff?
, mmrThreshold?
): [number
[], any
[]]
Parameters
Name | Type | Default value |
---|---|---|
queryEmbedding | number [] | undefined |
embeddings | number [][] | undefined |
similarityFn | null | (...args : any []) => number | null |
similarityTopK | null | number | null |
embeddingIds | null | any [] | null |
_similarityCutoff | null | number | null |
mmrThreshold | null | number | null |
Returns
[number
[], any
[]]
Defined in
packages/core/src/embeddings/utils.ts:123
imageToDataUrl
▸ imageToDataUrl(input
): Promise
<string
>
Parameters
Name | Type |
---|---|
input | ImageType |
Returns
Promise
<string
>
Defined in
packages/core/src/embeddings/utils.ts:237
imageToString
▸ imageToString(input
): Promise
<string
>
Parameters
Name | Type |
---|---|
input | ImageType |
Returns
Promise
<string
>
Defined in
packages/core/src/embeddings/utils.ts:209
jsonToIndexStruct
▸ jsonToIndexStruct(json
): IndexStruct
Parameters
Name | Type |
---|---|
json | any |
Returns
Defined in
packages/core/src/indices/BaseIndex.ts:74
jsonToNode
▸ jsonToNode(json
, type?
): TextNode
<Metadata
>
Parameters
Name | Type |
---|---|
json | any |
type? | ObjectType |
Returns
Defined in
messagesToHistoryStr
▸ messagesToHistoryStr(messages
): string
Parameters
Name | Type |
---|---|
messages | ChatMessage [] |
Returns
string
Defined in
packages/core/src/Prompt.ts:348
parseJsonMarkdown
▸ parseJsonMarkdown(text
): any
Parameters
Name | Type | Description |
---|---|---|
text | string | A markdown block with JSON |
Returns
any
parsed JSON object
Defined in
packages/core/src/OutputParser.ts:56
readImage
▸ readImage(input
): Promise
<RawImage
>
Parameters
Name | Type |
---|---|
input | ImageType |
Returns
Promise
<RawImage
>
Defined in
packages/core/src/embeddings/utils.ts:198
serviceContextFromDefaults
▸ serviceContextFromDefaults(options?
): ServiceContext
Parameters
Name | Type |
---|---|
options? | ServiceContextOptions |
Returns
Defined in
packages/core/src/ServiceContext.ts:30
serviceContextFromServiceContext
▸ serviceContextFromServiceContext(serviceContext
, options
): Object
Parameters
Name | Type |
---|---|
serviceContext | ServiceContext |
options | ServiceContextOptions |
Returns
Object
Name | Type |
---|---|
callbackManager | CallbackManager |
embedModel | BaseEmbedding |
llm | LLM |
nodeParser | NodeParser |
promptHelper | PromptHelper |
Defined in
packages/core/src/ServiceContext.ts:48
similarity
▸ similarity(embedding1
, embedding2
, mode?
): number
The similarity between two embeddings.
Parameters
Name | Type | Default value |
---|---|---|
embedding1 | number [] | undefined |
embedding2 | number [] | undefined |
mode | SimilarityType | SimilarityType.DEFAULT |
Returns
number
similarity score with higher numbers meaning the two embeddings are more similar
Defined in
packages/core/src/embeddings/utils.ts:15
splitNodesByType
▸ splitNodesByType(nodes
): Object
Parameters
Name | Type |
---|---|
nodes | BaseNode <Metadata >[] |
Returns
Object
Name | Type |
---|---|
imageNodes | ImageNode [] |
textNodes | TextNode [] |
Defined in
storageContextFromDefaults
▸ storageContextFromDefaults(«destructured»
): Promise
<StorageContext
>
Parameters
Name | Type |
---|---|
«destructured» | BuilderParams |
Returns
Promise
<StorageContext
>
Defined in
packages/core/src/storage/StorageContext.ts:32
stringToImage
▸ stringToImage(input
): ImageType
Parameters
Name | Type |
---|---|
input | string |
Returns
Defined in
packages/core/src/embeddings/utils.ts:222
walk
▸ walk(fs
, dirPath
): AsyncIterable
<string
>
Recursively traverses a directory and yields all the paths to the files in it.
Parameters
Name | Type | Description |
---|---|---|
fs | WalkableFileSystem | The filesystem to use. |
dirPath | string | The path to the directory to traverse. |
Returns
AsyncIterable
<string
>