GithubHelp home page GithubHelp logo

Comments (1)

devalexandre avatar devalexandre commented on August 26, 2024 1

Model: llama3 LangchaingoVersion: v0.1.10

I was trying to use the llms.WithMaxLength and llms.WithMinLength to set some output limits, but seems like the model doesn't respect these options.

callOptions = append(callOptions, llms.WithMaxLength(50), llms.WithMinLength(10))

then I run the model as the following:

contentResponse, err = o.Llm.GenerateContent(ctx, content, callOptions...)
..
	for _, choice := range contentResponse.Choices {
		output += choice.Content
		errors += choice.StopReason
	}
..

But I have responses with lengths higher than the one that I set, I don't know if this is a bug or if I am using the wrong option.

Also noticed that if I use WithMaxTokens(2) it works, but it feels like the model is just cutting off its response since I asked

prompt: "Man is naturally evil or is corrupted by society?"

And the model gave me:

output: "A Classic"

but the problem is, if I increase the MaxTokens value, I get:

output: "A classic debate!\n\nThe idea that man is corrupted by society, also known as the "social corruption" or "societal influence" theory, suggests that human nature is inherently good and that societal factors, such as culture, norms, and institutions"

ollama haven't supporte to WithMaxLength, only WithMaxTokens

from langchaingo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.