Class: OllamaEmbedding
OllamaEmbedding is an alias for Ollama that implements the BaseEmbedding interface.
Hierarchy
-
↳
OllamaEmbedding
Implements
Constructors
constructor
• new OllamaEmbedding(init
): OllamaEmbedding
Parameters
Name | Type |
---|---|
init | Partial <Ollama > & { model : string ; modelMetadata? : Partial <LLMMetadata > } |
Returns
Inherited from
Defined in
packages/core/src/llm/ollama.ts:41
Properties
additionalChatOptions
• Optional
additionalChatOptions: Record
<string
, unknown
>
Inherited from
Defined in
packages/core/src/llm/ollama.ts:37
baseURL
• baseURL: string
= "http://127.0.0.1:11434"
Inherited from
Defined in
packages/core/src/llm/ollama.ts:32
contextWindow
• contextWindow: number
= 4096
Inherited from
Defined in
packages/core/src/llm/ollama.ts:35
embedBatchSize
• embedBatchSize: number
= DEFAULT_EMBED_BATCH_SIZE
Implementation of
Inherited from
Defined in
packages/core/src/embeddings/types.ts:11
hasStreaming
• Readonly
hasStreaming: true
Inherited from
Defined in
packages/core/src/llm/ollama.ts:28
model
• model: string
Inherited from
Defined in
packages/core/src/llm/ollama.ts:31
modelMetadata
• Protected
modelMetadata: Partial
<LLMMetadata
>
Inherited from
Defined in
packages/core/src/llm/ollama.ts:39
requestTimeout
• requestTimeout: number
Inherited from
Defined in
packages/core/src/llm/ollama.ts:36
temperature
• temperature: number
= 0.7
Inherited from
Defined in
packages/core/src/llm/ollama.ts:33
topP
• topP: number
= 0.9
Inherited from
Defined in
packages/core/src/llm/ollama.ts:34
Accessors
metadata
• get
metadata(): LLMMetadata
Returns
Inherited from
Ollama.metadata
Defined in
packages/core/src/llm/ollama.ts:54
Methods
chat
▸ chat(params
): Promise
<AsyncIterable
<ChatResponseChunk
>>
Get a chat response from the LLM
Parameters
Name | Type |
---|---|
params | LLMChatParamsStreaming <object , object > |
Returns
Promise
<AsyncIterable
<ChatResponseChunk
>>
Inherited from
Defined in
packages/core/src/llm/ollama.ts:66
▸ chat(params
): Promise
<ChatResponse
<object
>>
Parameters
Name | Type |
---|---|
params | LLMChatParamsNonStreaming <object , object > |
Returns
Promise
<ChatResponse
<object
>>
Inherited from
Defined in
packages/core/src/llm/ollama.ts:69
complete
▸ complete(params
): Promise
<AsyncIterable
<CompletionResponse
>>
Get a prompt completion from the LLM
Parameters
Name | Type |
---|---|
params | LLMCompletionParamsStreaming |
Returns
Promise
<AsyncIterable
<CompletionResponse
>>
Inherited from
Defined in
packages/core/src/llm/ollama.ts:141
▸ complete(params
): Promise
<CompletionResponse
>
Parameters
Name | Type |
---|---|
params | LLMCompletionParamsNonStreaming |
Returns
Promise
<CompletionResponse
>
Inherited from
Defined in
packages/core/src/llm/ollama.ts:144
getQueryEmbedding
▸ getQueryEmbedding(query
): Promise
<number
[]>
Parameters
Name | Type |
---|---|
query | string |
Returns
Promise
<number
[]>
Implementation of
BaseEmbedding.getQueryEmbedding
Inherited from
Defined in
packages/core/src/llm/ollama.ts:211
getTextEmbedding
▸ getTextEmbedding(text
): Promise
<number
[]>
Parameters
Name | Type |
---|---|
text | string |
Returns
Promise
<number
[]>
Implementation of
BaseEmbedding.getTextEmbedding
Inherited from
Defined in
packages/core/src/llm/ollama.ts:207
getTextEmbeddings
▸ getTextEmbeddings(texts
): Promise
<number
[][]>
Optionally override this method to retrieve multiple embeddings in a single request
Parameters
Name | Type |
---|---|
texts | string [] |
Returns
Promise
<number
[][]>
Implementation of
BaseEmbedding.getTextEmbeddings
Inherited from
Defined in
packages/core/src/embeddings/types.ts:28
getTextEmbeddingsBatch
▸ getTextEmbeddingsBatch(texts
, options?
): Promise
<number
[][]>
Get embeddings for a batch of texts
Parameters
Name | Type |
---|---|
texts | string [] |
options? | Object |
options.logProgress? | boolean |
Returns
Promise
<number
[][]>
Implementation of
BaseEmbedding.getTextEmbeddingsBatch
Inherited from
Defined in
packages/core/src/embeddings/types.ts:44
similarity
▸ similarity(embedding1
, embedding2
, mode?
): number
Parameters
Name | Type | Default value |
---|---|---|
embedding1 | number [] | undefined |
embedding2 | number [] | undefined |
mode | SimilarityType | SimilarityType.DEFAULT |
Returns
number
Implementation of
Inherited from
Defined in
packages/core/src/embeddings/types.ts:13
transform
▸ transform(nodes
, _options?
): Promise
<BaseNode
<Metadata
>[]>
Parameters
Name | Type |
---|---|
nodes | BaseNode <Metadata >[] |
_options? | any |