Giter VIP home page Giter VIP logo

Comments (3)

HamaWhiteGG avatar HamaWhiteGG commented on August 9, 2024

Yes, I will implement it as soon as possible. Could you please provide me with your example so that I can test it?

from langchain-java.

fmatar avatar fmatar commented on August 9, 2024

I'm more than happy to create a fork and showcase my changes

from langchain-java.

HamaWhiteGG avatar HamaWhiteGG commented on August 9, 2024

Structured output parser is now supported, please refer to StructuredOutputParserTest for details.
Here is one of the test cases:

void testStructuredOutputParserWithLLM() {
    var outputParser = createOutputParser();
    var prompt = new PromptTemplate(
            "answer the users question as best as possible.\n{format_instructions}\n{question}",
            List.of("question"),
            Map.of("format_instructions", outputParser.getFormatInstructions()));

    var llm = OpenAI.builder().temperature(0).build().init();
    var input = prompt.formatPrompt(Map.of("question", "what's the capital of france?"));
    var output = llm.call(input.toString());

    var actual = outputParser.parse(output);
    var expected = new ObjectMapper().createObjectNode()
            .put("answer", "Paris")
            .put("source", "https://www.worldatlas.com/articles/what-is-the-capital-of-france.html");
    assertEquals(expected, actual);
}

from langchain-java.

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.