Skip to content

Commit

Permalink
Miscellaneous tidy ups
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesnetherton committed Jun 28, 2024
1 parent 1847b47 commit a18f2bf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void reflectiveClasses(CombinedIndexBuildItem combinedIndex, BuildProducer<Refle
|| n.startsWith("com.azure.storage.queue.models."))
.sorted()
.toArray(String[]::new);
reflectiveClasses.produce(ReflectiveClassBuildItem.builder(modelClasses).fields().serialization().build());
reflectiveClasses.produce(ReflectiveClassBuildItem.builder(modelClasses).fields().build());

final String[] knownSerializableImpls = combinedIndex.getIndex()
.getAllKnownImplementors(XML_SERIALIZABLE_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,13 @@ void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveCla
.toArray(String[]::new);
reflectiveClass.produce(ReflectiveClassBuildItem.builder(jaxrsAnnotations).methods().build());

//constructors for converters
// reflective instantiation of xchange converters
String[] converterClasses = index.getAllKnownSubclasses("com.fasterxml.jackson.databind.util.StdConverter")
.stream()
.map(classInfo -> classInfo.name().toString())
.filter(className -> className.startsWith("org.knowm.xchange"))
.toArray(String[]::new);
reflectiveClass.produce(ReflectiveClassBuildItem.builder(converterClasses).methods().fields().build());
reflectiveClass.produce(ReflectiveClassBuildItem.builder(converterClasses).build());
}

@BuildStep
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/dataformat/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@


<profiles>
<profile>
<profile>
<id>native</id>
<activation>
<property>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,11 @@
*/
package org.apache.camel.quarkus.component.langchain.chat.it;

import dev.langchain4j.model.chat.ChatLanguageModel;
import io.quarkiverse.langchain4j.ollama.OllamaChatLanguageModel;
import io.quarkiverse.langchain4j.ollama.Options;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.inject.Produces;
import org.apache.camel.builder.RouteBuilder;
import org.eclipse.microprofile.config.inject.ConfigProperty;

import static java.time.Duration.ofSeconds;

@ApplicationScoped
public class OllamaRoute extends RouteBuilder {

@ConfigProperty(name = "quarkus.langchain4j.ollama.base-url")
private String ollamaUrl;

@Override
public void configure() throws Exception {
from("direct:send-simple-message?timeout=30000")
Expand All @@ -46,15 +35,4 @@ public void configure() throws Exception {
.to("langchain4j-chat:test3?chatOperation=CHAT_MULTIPLE_MESSAGES")
.to("mock:multipleMessageResponse");
}

//model reflects the values in wire-mocked response
@Produces
public ChatLanguageModel produceModel() {
return OllamaChatLanguageModel.builder()
.options(Options.builder().temperature(0.3).topK(40).topP(0.9).build())
.model("orca-mini")
.baseUrl(ollamaUrl)
.timeout(ofSeconds(3000))
.build();
}
}

0 comments on commit a18f2bf

Please sign in to comment.