quarkiverse / quarkus-langchain4j

Quarkus Langchain4j extension
https://docs.quarkiverse.io/quarkus-langchain4j/dev/index.html
Apache License 2.0
147 stars 88 forks source link

How to enable JSON mode for azure-openai ? #466

Closed Plawn closed 6 months ago

Plawn commented 7 months ago

Hello,

Sorry to bother you with such questions :),

I can't seem to enable the json mode with azure-open, looking in the code, it seems it should work with this configuration but It's not working.

quarkus:
  # settings for the models
  langchain4j:
    azure-openai: # should be azure open ai
      api-key:<key>
      resource-name: <name>
      deployment-name: <name>
      response-format: json_object

Looking in the langchain4j documentation, It looks like the way to configure the responseFormat is not the Same for the OpenAIClient and the AzureOpenAiClient.

Thanks

UnvirtualHH commented 7 months ago

It looks like the responseFormat is just implemented for the image model, actually not for chat model. Maybe I can provide a PR tomorrow.

Plawn commented 7 months ago

Many are the thanks

geoand commented 6 months ago

Looking in the langchain4j documentation

Can you please point to where you see this in the documentation?

Plawn commented 6 months ago

Here it is !

https://docs.langchain4j.dev/tutorials/ai-services/#json-mode

🚀

geoand commented 6 months ago

Oh I see!

So indeed we need to add that AzureAI feature here too.

geoand commented 6 months ago

It looks like the responseFormat is just implemented for the image model, actually not for chat model. Maybe I can provide a PR tomorrow.

This would be very nice!

UnvirtualHH commented 6 months ago

I'm still struggling with formatting lf/crlf topics, fix is locally working, but not sure what is wrong with my ide...

geoand commented 6 months ago

You can just do mvn install -f openai/azure-openai and commit after the changes the auto-formatting makes.

UnvirtualHH commented 6 months ago

Well, looks like I got it. Here is the PR: https://github.com/quarkiverse/quarkus-langchain4j/pull/483 Just mixed up my private and my work account, but this shouldn't be a problem.

geoand commented 6 months ago

Closed by #483