@markprompt/core
Advanced tools
Comparing version 0.8.0 to 0.8.1
export { submitFeedback, type SubmitFeedbackOptions, type SubmitFeedbackBody, DEFAULT_SUBMIT_FEEDBACK_OPTIONS, } from './feedback.js'; | ||
export { submitPrompt, type SubmitPromptOptions, DEFAULT_SUBMIT_PROMPT_OPTIONS, STREAM_SEPARATOR, } from './prompt.js'; | ||
export { submitSearchQuery, type SubmitSearchQueryOptions, DEFAULT_SUBMIT_SEARCH_QUERY_OPTIONS, } from './search.js'; | ||
export { type FileSectionReference, type OpenAIModelId, type OpenAIChatCompletionsModelId, type OpenAICompletionsModelId, type OpenAIEmbeddingsModelId, type SearchResult, type SearchResultSection, type SearchResultsResponse, type Source, type SourceType, } from './types.js'; | ||
export { type FileSectionReference, type FileReferenceFileData, type OpenAIModelId, type OpenAIChatCompletionsModelId, type OpenAICompletionsModelId, type OpenAIEmbeddingsModelId, type SearchResult, type SearchResultSection, type SearchResultsResponse, type Source, type SourceType, } from './types.js'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -20,3 +20,3 @@ import type { FileSectionReference, OpenAIModelId } from './types.js'; | ||
* The prompt template | ||
* @default "You are a very enthusiastic company representative who loves to help people! Given the following sections from the documentation (preceded by a section id), answer the question using only that information, outputted in Markdown format. If you are unsure and the answer is not explicitly written in the documentation, you can say 'I don't know' and the question will be passed to the OpenAI model."" | ||
* @default "You are a very enthusiastic company representative who loves to help people! Given the following sections from the documentation (preceded by a section id), answer the question using only that information, outputted in Markdown format. If you are unsure and the answer is not explicitly written in the documentation, say \"{{I_DONT_KNOW}}\".\n\nContext sections:\n---\n{{CONTEXT}}\n\nQuestion: \"{{PROMPT}}\"\n\nAnswer (including related code snippets if available):\n" | ||
**/ | ||
@@ -68,12 +68,12 @@ promptTemplate?: string; | ||
/** | ||
* Submit a prompt the the Markprompt API. | ||
* Submit a prompt to the Markprompt Completions API. | ||
* | ||
* @param prompt - Prompt to submit to the model | ||
* @param projectKey - The key of your project | ||
* @param projectKey - Project key for the project | ||
* @param onAnswerChunk - Answers come in via streaming. This function is called when a new chunk arrives | ||
* @param onReferences - This function is called when a chunk includes references. | ||
* @param onError - called when an error occurs | ||
* @param [options] - Optional options object | ||
* @param onError - Called when an error occurs | ||
* @param [options] - Optional parameters | ||
*/ | ||
export declare function submitPrompt(prompt: string, projectKey: string, onAnswerChunk: (answerChunk: string) => boolean | undefined | void, onReferences: (references: FileSectionReference[]) => void, onError: (error: Error) => void, options?: SubmitPromptOptions, debug?: boolean): Promise<void>; | ||
//# sourceMappingURL=prompt.d.ts.map |
@@ -17,10 +17,10 @@ import { parseEncodedJSONHeader } from './utils.js'; | ||
/** | ||
* Submit a prompt the the Markprompt API. | ||
* Submit a prompt to the Markprompt Completions API. | ||
* | ||
* @param prompt - Prompt to submit to the model | ||
* @param projectKey - The key of your project | ||
* @param projectKey - Project key for the project | ||
* @param onAnswerChunk - Answers come in via streaming. This function is called when a new chunk arrives | ||
* @param onReferences - This function is called when a chunk includes references. | ||
* @param onError - called when an error occurs | ||
* @param [options] - Optional options object | ||
* @param onError - Called when an error occurs | ||
* @param [options] - Optional parameters | ||
*/ | ||
@@ -27,0 +27,0 @@ export async function submitPrompt(prompt, projectKey, onAnswerChunk, onReferences, onError, options = {}, debug) { |
@@ -21,6 +21,6 @@ import type { SearchResultsResponse } from './types.js'; | ||
/** | ||
* Submit a search query to the Markprompt Search API endpoint. | ||
* Submit a search query to the Markprompt Search API. | ||
* @param query - Search query | ||
* @param projectKey - Project key for the project to search | ||
* @param options - Optional parameters | ||
* @param projectKey - Project key for the project | ||
* @param [options] - Optional parameters | ||
* @returns Search results | ||
@@ -27,0 +27,0 @@ */ |
@@ -7,6 +7,6 @@ import { getErrorMessage } from './utils.js'; | ||
/** | ||
* Submit a search query to the Markprompt Search API endpoint. | ||
* Submit a search query to the Markprompt Search API. | ||
* @param query - Search query | ||
* @param projectKey - Project key for the project to search | ||
* @param options - Optional parameters | ||
* @param projectKey - Project key for the project | ||
* @param [options] - Optional parameters | ||
* @returns Search results | ||
@@ -13,0 +13,0 @@ */ |
{ | ||
"name": "@markprompt/core", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
@@ -36,28 +36,28 @@ # `@markprompt/core` | ||
// user input | ||
const prompt = 'Hello, Markprompt!'; | ||
// can be obtained in your project settings on markprompt.com | ||
// User input | ||
const prompt = 'What is Markprompt?'; | ||
// Can be obtained in your project settings on markprompt.com | ||
const projectKey = 'YOUR-PROJECT-KEY'; | ||
// called when a new answer chunk is available | ||
// should be concatenated to previous chunks | ||
// Called when a new answer chunk is available | ||
// Should be concatenated to previous chunks | ||
function onAnswerChunk(chunk) { | ||
// process an answer chunk | ||
// Process an answer chunk | ||
} | ||
// called when references are available | ||
// Called when references are available | ||
function onReferences(references) { | ||
// process references | ||
// Process references | ||
} | ||
// called when submitPrompt encounters an error | ||
// Called when submitPrompt encounters an error | ||
const onError(error) { | ||
// handle errors | ||
// Handle errors | ||
} | ||
// optional options, defaults displayed | ||
// Optional parameters, defaults displayed | ||
const options = { | ||
model: 'gpt-3.5-turbo', // supports all OpenAI models | ||
model: 'gpt-3.5-turbo', // Supports all OpenAI models | ||
iDontKnowMessage: 'Sorry, I am not sure how to answer that.', | ||
apiUrl: 'https://api.markprompt.com/v1/completions', // or your own completions API endpoint, | ||
apiUrl: 'https://api.markprompt.com/v1/completions', // Or your own completions API endpoint | ||
}; | ||
@@ -72,3 +72,3 @@ | ||
Submit a prompt the the Markprompt API. | ||
Submit a prompt to the Markprompt Completions API. | ||
@@ -78,7 +78,7 @@ #### Arguments | ||
- `prompt` (`string`): Prompt to submit to the model | ||
- `projectKey` (`string`): The key of your project | ||
- `projectKey` (`string`): Project key for the project | ||
- `onAnswerChunk` (`function`): Answers come in via streaming. This function is called when a new chunk arrives | ||
- `onReferences` (`function`): This function is called when receiving the list of references from which the response was created. | ||
- `onError` (`function`): called when an error occurs | ||
- [`options`](#options) (`object`): Optional options object | ||
- [`options`](#options) (`object`): Optional parameters | ||
@@ -104,2 +104,22 @@ #### Options | ||
### `submitSearchQuery(query, projectKey, options?)` | ||
Submit a search query to the Markprompt Search API. | ||
#### Arguments | ||
- `query` (`string`): Search query | ||
- `projectKey` (`string`): Project key for the project | ||
- [`options`](#options) (`object`): Optional parameters | ||
#### Options | ||
- `apiUrl` (`string`): URL at which to fetch search results | ||
- `limit` (`number`): Maximum amount of results to return | ||
- `signal` (`AbortSignal`): AbortController signal | ||
#### Returns | ||
A list of search results. | ||
## Community | ||
@@ -106,0 +126,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43056
529
134