Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Dynamic Model Switching and Custom Function Handler #8

Open
MMMartt opened this issue Dec 2, 2024 · 2 comments
Open

Comments

@MMMartt
Copy link

MMMartt commented Dec 2, 2024

I am currently using your latitude-llm, and I find it very useful. However, I have a need to dynamically replace model parameters based on variables (e.g., switching model=gpt-4o to gpt-4o). I believe this logic would be well-suited for integration into the template engine. Additionally, support for syntax like {{if .model | contains "gpt"}} model is gpt model {{end}} would be incredibly helpful. I’d like to ask if there are any plans to support such functionality, as I think it would be a great feature to have.

@MMMartt MMMartt changed the title Will custom handler (call function in template) be supported? Feature Request: Dynamic Model Switching and Custom Function Handler Dec 2, 2024
@neoxelox
Copy link
Contributor

cc @csansoon

@csansoon
Copy link
Contributor

Hi, @MMMartt!

Sure, let me guide you through how to do this!

In the configuration section at the top of the document parameters are not currently allowed. However, you can use the step tag to add variable configurations. The step tag is originally used to define chains. However, a single prompt can also be defined as a "1-step chain".

Let me show you an example:

---
provider: <any-provider>
model: <any-model>
<other-configuration>
---

{{ my_model = "gpt-4o" }}
/* This could also just be a parameter, so you
    do not need to define it here */

<step model={{my_model}} > /* Model is being replaced here for this step */
  {{ if my_model.includes("gpt") }}
    Model is gpt
  {{ endif }}
  
  /* Rest of the prompt */
</step>

Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants