GithubHelp home page GithubHelp logo

Comments (3)

devalexandre avatar devalexandre commented on July 23, 2024 1

@devalexandre Yes, I was able to achieve it with the following code:

response, err := client.GenerateContent(ctx, content, llms.WithJSONMode())

However, I noticed that there are unused keys for every OpenAI LLM, specifically "openai.WithResponseFormat(responseFormat)", which isn't being utilized. I wanted to report this issue here.

this is not BUG as we have option base but for each LLM, use some options, never use all.

maybe we could return a error if some option aren't used.

from langchaingo.

devalexandre avatar devalexandre commented on July 23, 2024
ctx := context.Background()

client, err := openai.New(openai.WithModel("gpt-3.5-turbo")))

	content := []llms.MessageContent{
		llms.TextParts(llms.ChatMessageTypeSystem, "You are a company branding design wizard."),
		llms.TextParts(llms.ChatMessageTypeHuman, "What would be a good company name a company that makes colorful socks?"),
	}

//add type in request
	opts := llms.CallOptions{
		JSONMode: true,
	}

	resp, err := client.GenerateContent(ctx, content,opts)

	fmt.Println(resp.Choices)

	for _, message := range resp.Choices {
		fmt.Println(message.Content)
	}

	return err
	``

from langchaingo.

gowthamkishore3799 avatar gowthamkishore3799 commented on July 23, 2024

@devalexandre Yes, I was able to achieve it with the following code:

response, err := client.GenerateContent(ctx, content, llms.WithJSONMode())

However, I noticed that there are unused keys for every OpenAI LLM, specifically "openai.WithResponseFormat(responseFormat)", which isn't being utilized. I wanted to report this issue here.

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.