Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into mcpservers
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Nov 30, 2024
2 parents 67efa53 + 11e3007 commit 69a6657
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
12 changes: 11 additions & 1 deletion docs/src/content/docs/getting-started/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,13 @@ docker stop ollama && docker rm ollama
## LMStudio

The `lmstudio` provider connects to the [LMStudio](https://lmstudio.ai/) headless server.
and allows to run local LLMs.
and allows to run local LLMs.

:::note

LMStudio 0.3.5 beta 4 or later is required.

:::

<Steps>

Expand Down Expand Up @@ -1155,6 +1161,10 @@ script({
})
```

### LMStudio and Hugging Face Models

Follow [this guide](https://huggingface.co/blog/yagilb/lms-hf) to load Hugging Face models into LMStudio.

## LocalAI

[LocalAI](https://localai.io/) act as a drop-in replacement REST API that’s compatible
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/math.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import { TraceOptions } from "./trace"
*/
export async function MathTryEvaluate(
expr: string,
options?: { defaultValue?: number } & TraceOptions
options?: { scope?: object; defaultValue?: number } & TraceOptions
): Promise<string | number | undefined> {
// Destructuring options with defaults
const { trace, defaultValue } = options || {}
const { trace, defaultValue, scope } = options || {}

try {
// Return defaultValue if expression is empty
Expand All @@ -29,7 +29,7 @@ export async function MathTryEvaluate(
const { evaluate } = await import("mathjs")

// Evaluate the expression and return the result
const res = evaluate(expr)
const res = evaluate(expr, scope)
return res
} catch (e) {
// Log an error if tracing is enabled
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/parsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ export async function createParsers(options: {
await resolveFileContent(file, { trace })
return await treeSitterQuery(file, query, { trace })
},
math: async (expression) =>
await MathTryEvaluate(expression, { trace }),
math: async (expression, scope) =>
await MathTryEvaluate(expression, { scope, trace }),
validateJSON: (schema, content) =>
validateJSONWithSchema(content, schema, { trace }),
mustache: (file, args) => {
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/types/prompt_template.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1477,8 +1477,12 @@ interface Parsers {
/**
* Parses and evaluates a math expression
* @param expression math expression compatible with mathjs
* @param scope object to read/write variables
*/
math(expression: string): Promise<string | number | undefined>
math(
expression: string,
scope?: object
): Promise<string | number | undefined>

/**
* Using the JSON schema, validates the content
Expand Down

0 comments on commit 69a6657

Please sign in to comment.