@digipair/skill-ollama 0.2.5 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs2.js +40 -18
- package/index.esm2.js +40 -18
- package/package.json +1 -1
package/index.cjs2.js
CHANGED
@@ -45758,19 +45758,27 @@ function jsonSchemaToZod(schema) {
|
|
45758
45758
|
}
|
45759
45759
|
let OllamaService = class OllamaService {
|
45760
45760
|
async basic(params, _pins, _context) {
|
45761
|
-
const { modelName = 'mistral', temperature = 0, baseUrl = OLLAMA_SERVER, prompt, schema } = params;
|
45762
|
-
const model = new Ollama({
|
45763
|
-
model: modelName,
|
45764
|
-
temperature,
|
45765
|
-
baseUrl
|
45766
|
-
});
|
45761
|
+
const { modelName = 'mistral', temperature = 0, keepAlive = '1440m', baseUrl = OLLAMA_SERVER, prompt, schema } = params;
|
45767
45762
|
let chain;
|
45768
45763
|
if (!schema) {
|
45764
|
+
const model = new Ollama({
|
45765
|
+
model: modelName,
|
45766
|
+
temperature,
|
45767
|
+
keepAlive,
|
45768
|
+
baseUrl
|
45769
|
+
});
|
45769
45770
|
chain = RunnableSequence.from([
|
45770
45771
|
PromptTemplate.fromTemplate(prompt != null ? prompt : '{prompt}'),
|
45771
45772
|
model
|
45772
45773
|
]);
|
45773
45774
|
} else {
|
45775
|
+
const model = new Ollama({
|
45776
|
+
model: modelName,
|
45777
|
+
temperature,
|
45778
|
+
baseUrl,
|
45779
|
+
keepAlive,
|
45780
|
+
format: 'json'
|
45781
|
+
});
|
45774
45782
|
const parser = new StructuredOutputParser(jsonSchemaToZod(schema));
|
45775
45783
|
chain = RunnableSequence.from([
|
45776
45784
|
PromptTemplate.fromTemplate(`Answer the users question as best as possible.\n{format_instructions}\n${prompt != null ? prompt : '{prompt}'}\n\nJSON:`, {
|
@@ -45785,24 +45793,37 @@ let OllamaService = class OllamaService {
|
|
45785
45793
|
return chain;
|
45786
45794
|
}
|
45787
45795
|
async vision(params, _pins, _context) {
|
45788
|
-
const { modelName = 'llava', temperature = 0, baseUrl = OLLAMA_SERVER, schema, prompt, image } = params;
|
45789
|
-
const model = new Ollama({
|
45790
|
-
model: modelName,
|
45791
|
-
temperature,
|
45792
|
-
baseUrl
|
45793
|
-
}).bind({
|
45794
|
-
images: [
|
45795
|
-
image.split(';base64,')[1]
|
45796
|
-
],
|
45797
|
-
prompt
|
45798
|
-
});
|
45796
|
+
const { modelName = 'llava', temperature = 0, keepAlive = '1440m', baseUrl = OLLAMA_SERVER, schema, prompt, image } = params;
|
45799
45797
|
let chain;
|
45800
45798
|
if (!schema) {
|
45799
|
+
const model = new Ollama({
|
45800
|
+
model: modelName,
|
45801
|
+
temperature,
|
45802
|
+
keepAlive,
|
45803
|
+
baseUrl
|
45804
|
+
}).bind({
|
45805
|
+
images: [
|
45806
|
+
image.split(';base64,')[1]
|
45807
|
+
],
|
45808
|
+
prompt
|
45809
|
+
});
|
45801
45810
|
chain = RunnableSequence.from([
|
45802
45811
|
PromptTemplate.fromTemplate(prompt != null ? prompt : '{prompt}'),
|
45803
45812
|
model
|
45804
45813
|
]);
|
45805
45814
|
} else {
|
45815
|
+
const model = new Ollama({
|
45816
|
+
model: modelName,
|
45817
|
+
temperature,
|
45818
|
+
keepAlive,
|
45819
|
+
baseUrl,
|
45820
|
+
format: 'json'
|
45821
|
+
}).bind({
|
45822
|
+
images: [
|
45823
|
+
image.split(';base64,')[1]
|
45824
|
+
],
|
45825
|
+
prompt
|
45826
|
+
});
|
45806
45827
|
const parser = new StructuredOutputParser(jsonSchemaToZod(schema));
|
45807
45828
|
chain = RunnableSequence.from([
|
45808
45829
|
PromptTemplate.fromTemplate(`Answer the users question as best as possible.\n{format_instructions}\n${prompt != null ? prompt : '{prompt}'}\n\nJSON:`, {
|
@@ -45817,10 +45838,11 @@ let OllamaService = class OllamaService {
|
|
45817
45838
|
return chain;
|
45818
45839
|
}
|
45819
45840
|
async summarization(params, _pins, _context) {
|
45820
|
-
const { modelName = 'mistral', temperature = 0, baseUrl = OLLAMA_SERVER, chunkSize = 1024, type = 'map_reduce', verbose = false, prompt, combineMapPrompt, combinePrompt, returnIntermediateSteps, refinePrompt, questionPrompt } = params;
|
45841
|
+
const { modelName = 'mistral', temperature = 0, keepAlive = '1440m', baseUrl = OLLAMA_SERVER, chunkSize = 1024, type = 'map_reduce', verbose = false, prompt, combineMapPrompt, combinePrompt, returnIntermediateSteps, refinePrompt, questionPrompt } = params;
|
45821
45842
|
const model = new Ollama({
|
45822
45843
|
model: modelName,
|
45823
45844
|
temperature,
|
45845
|
+
keepAlive,
|
45824
45846
|
baseUrl
|
45825
45847
|
});
|
45826
45848
|
const textSplitter = new RecursiveCharacterTextSplitter({
|
package/index.esm2.js
CHANGED
@@ -45756,19 +45756,27 @@ function jsonSchemaToZod(schema) {
|
|
45756
45756
|
}
|
45757
45757
|
let OllamaService = class OllamaService {
|
45758
45758
|
async basic(params, _pins, _context) {
|
45759
|
-
const { modelName = 'mistral', temperature = 0, baseUrl = OLLAMA_SERVER, prompt, schema } = params;
|
45760
|
-
const model = new Ollama({
|
45761
|
-
model: modelName,
|
45762
|
-
temperature,
|
45763
|
-
baseUrl
|
45764
|
-
});
|
45759
|
+
const { modelName = 'mistral', temperature = 0, keepAlive = '1440m', baseUrl = OLLAMA_SERVER, prompt, schema } = params;
|
45765
45760
|
let chain;
|
45766
45761
|
if (!schema) {
|
45762
|
+
const model = new Ollama({
|
45763
|
+
model: modelName,
|
45764
|
+
temperature,
|
45765
|
+
keepAlive,
|
45766
|
+
baseUrl
|
45767
|
+
});
|
45767
45768
|
chain = RunnableSequence.from([
|
45768
45769
|
PromptTemplate.fromTemplate(prompt != null ? prompt : '{prompt}'),
|
45769
45770
|
model
|
45770
45771
|
]);
|
45771
45772
|
} else {
|
45773
|
+
const model = new Ollama({
|
45774
|
+
model: modelName,
|
45775
|
+
temperature,
|
45776
|
+
baseUrl,
|
45777
|
+
keepAlive,
|
45778
|
+
format: 'json'
|
45779
|
+
});
|
45772
45780
|
const parser = new StructuredOutputParser(jsonSchemaToZod(schema));
|
45773
45781
|
chain = RunnableSequence.from([
|
45774
45782
|
PromptTemplate.fromTemplate(`Answer the users question as best as possible.\n{format_instructions}\n${prompt != null ? prompt : '{prompt}'}\n\nJSON:`, {
|
@@ -45783,24 +45791,37 @@ let OllamaService = class OllamaService {
|
|
45783
45791
|
return chain;
|
45784
45792
|
}
|
45785
45793
|
async vision(params, _pins, _context) {
|
45786
|
-
const { modelName = 'llava', temperature = 0, baseUrl = OLLAMA_SERVER, schema, prompt, image } = params;
|
45787
|
-
const model = new Ollama({
|
45788
|
-
model: modelName,
|
45789
|
-
temperature,
|
45790
|
-
baseUrl
|
45791
|
-
}).bind({
|
45792
|
-
images: [
|
45793
|
-
image.split(';base64,')[1]
|
45794
|
-
],
|
45795
|
-
prompt
|
45796
|
-
});
|
45794
|
+
const { modelName = 'llava', temperature = 0, keepAlive = '1440m', baseUrl = OLLAMA_SERVER, schema, prompt, image } = params;
|
45797
45795
|
let chain;
|
45798
45796
|
if (!schema) {
|
45797
|
+
const model = new Ollama({
|
45798
|
+
model: modelName,
|
45799
|
+
temperature,
|
45800
|
+
keepAlive,
|
45801
|
+
baseUrl
|
45802
|
+
}).bind({
|
45803
|
+
images: [
|
45804
|
+
image.split(';base64,')[1]
|
45805
|
+
],
|
45806
|
+
prompt
|
45807
|
+
});
|
45799
45808
|
chain = RunnableSequence.from([
|
45800
45809
|
PromptTemplate.fromTemplate(prompt != null ? prompt : '{prompt}'),
|
45801
45810
|
model
|
45802
45811
|
]);
|
45803
45812
|
} else {
|
45813
|
+
const model = new Ollama({
|
45814
|
+
model: modelName,
|
45815
|
+
temperature,
|
45816
|
+
keepAlive,
|
45817
|
+
baseUrl,
|
45818
|
+
format: 'json'
|
45819
|
+
}).bind({
|
45820
|
+
images: [
|
45821
|
+
image.split(';base64,')[1]
|
45822
|
+
],
|
45823
|
+
prompt
|
45824
|
+
});
|
45804
45825
|
const parser = new StructuredOutputParser(jsonSchemaToZod(schema));
|
45805
45826
|
chain = RunnableSequence.from([
|
45806
45827
|
PromptTemplate.fromTemplate(`Answer the users question as best as possible.\n{format_instructions}\n${prompt != null ? prompt : '{prompt}'}\n\nJSON:`, {
|
@@ -45815,10 +45836,11 @@ let OllamaService = class OllamaService {
|
|
45815
45836
|
return chain;
|
45816
45837
|
}
|
45817
45838
|
async summarization(params, _pins, _context) {
|
45818
|
-
const { modelName = 'mistral', temperature = 0, baseUrl = OLLAMA_SERVER, chunkSize = 1024, type = 'map_reduce', verbose = false, prompt, combineMapPrompt, combinePrompt, returnIntermediateSteps, refinePrompt, questionPrompt } = params;
|
45839
|
+
const { modelName = 'mistral', temperature = 0, keepAlive = '1440m', baseUrl = OLLAMA_SERVER, chunkSize = 1024, type = 'map_reduce', verbose = false, prompt, combineMapPrompt, combinePrompt, returnIntermediateSteps, refinePrompt, questionPrompt } = params;
|
45819
45840
|
const model = new Ollama({
|
45820
45841
|
model: modelName,
|
45821
45842
|
temperature,
|
45843
|
+
keepAlive,
|
45822
45844
|
baseUrl
|
45823
45845
|
});
|
45824
45846
|
const textSplitter = new RecursiveCharacterTextSplitter({
|