Skip to content

Function calling for LMStudio #344

@jaronoff97

Description

@jaronoff97

I'm using LMStudio with Llama hoping to use custom langchain functions with it. I can see that the tools are loaded:

TOOLS: [
  %LangChain.Function{
    name: "validate_promql",
    description: "Validate the syntax of a PromQL query. Return 'ok' or an error message.",
    display_text: nil,
    strict: false,
    function: #Function<0.126923400/2 in Intel.PromQL.Model.validate_promql_tool/0>,
    async: true,
    parameters_schema: %{
      type: "object",
      required: ["query"],
      properties: %{
        query: %{type: "string", description: "The PromQL query to validate"}
      }
    },
    parameters: []
  }
]

and that the model attempts to call the function, but it's trying it via python?

SINGLE MESSAGE RESPONSE: %LangChain.Message{
  content: "<|python_tag|>{\"type\": \"function\", \"function\": {\"name\": \"validate_promql\", \"parameters\": {\"query\": \"rate(last(accepted_metrics) by item)\"}}",
  processed_content: nil,
  index: 0,
  status: :complete,
  role: :assistant,
  name: nil,
  tool_calls: [],
  tool_results: nil,
  metadata: nil
}

Is there something custom i need to do in LMStudio or langchain to make this work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions