Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix named AiService handling #1149

Merged
merged 2 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -718,8 +718,6 @@ public void handleDeclarativeServices(AiServicesRecorder recorder,
allToolProviders.add(toolProvider);
}

bi.getBeanName().ifPresent(beanName -> configurator.named(beanName));

configurator
.addInjectionPoint(ParameterizedType.create(DotNames.CDI_INSTANCE,
new Type[] { ClassType.create(OutputGuardrail.class) }, null))
Expand Down Expand Up @@ -1057,12 +1055,16 @@ public void handleAiServices(
try (ClassCreator classCreator = classCreatorBuilder.build()) {
if (isRegisteredService) {
// we need to make this a bean, so we need to add the proper scope annotation
DotName scopeInfo = declarativeAiServiceItems.stream()
DeclarativeAiServiceBuildItem matchingBI = declarativeAiServiceItems.stream()
.filter(bi -> bi.getServiceClassInfo().equals(iface))
.findFirst().orElseThrow(() -> new IllegalStateException(
"Unable to determine the CDI scope of " + iface))
.getCdiScope();
"Unable to determine the CDI scope of " + iface));
DotName scopeInfo = matchingBI.getCdiScope();
classCreator.addAnnotation(scopeInfo.toString());
if (matchingBI.getBeanName().isPresent()) {
classCreator.addAnnotation(
AnnotationInstance.builder(NAMED).add("value", matchingBI.getBeanName().get()).build());
}
}

FieldDescriptor contextField = classCreator.getFieldCreator("context", QuarkusAiServiceContext.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Environment variable: `+++QUARKUS_LANGCHAIN4J_LLAMA3_MODELS_PATH+++`
endif::add-copy-button-to-env-var[]
--
|path
|`${user.home}/.langchain4j/models`
|`${user.name}/.llama3java/models`

a| [[quarkus-langchain4j-llama3-java_quarkus-langchain4j-llama3-chat-model-temperature]] [.property-path]##link:#quarkus-langchain4j-llama3-java_quarkus-langchain4j-llama3-chat-model-temperature[`quarkus.langchain4j.llama3.chat-model.temperature`]##

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Environment variable: `+++QUARKUS_LANGCHAIN4J_LLAMA3_MODELS_PATH+++`
endif::add-copy-button-to-env-var[]
--
|path
|`${user.home}/.langchain4j/models`
|`${user.name}/.llama3java/models`

a| [[quarkus-langchain4j-llama3-java_quarkus-langchain4j-llama3-chat-model-temperature]] [.property-path]##link:#quarkus-langchain4j-llama3-java_quarkus-langchain4j-llama3-chat-model-temperature[`quarkus.langchain4j.llama3.chat-model.temperature`]##

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,23 @@ endif::add-copy-button-to-env-var[]
|string
|

a| [[quarkus-langchain4j-openai_quarkus-langchain4j-openai-chat-model-strict-json-schema]] [.property-path]##link:#quarkus-langchain4j-openai_quarkus-langchain4j-openai-chat-model-strict-json-schema[`quarkus.langchain4j.openai.chat-model.strict-json-schema`]##

[.description]
--
Whether responses follow JSON Schema for Structured Outputs


ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_OPENAI_CHAT_MODEL_STRICT_JSON_SCHEMA+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_OPENAI_CHAT_MODEL_STRICT_JSON_SCHEMA+++`
endif::add-copy-button-to-env-var[]
--
|boolean
|

a| [[quarkus-langchain4j-openai_quarkus-langchain4j-openai-chat-model-stop]] [.property-path]##link:#quarkus-langchain4j-openai_quarkus-langchain4j-openai-chat-model-stop[`quarkus.langchain4j.openai.chat-model.stop`]##

[.description]
Expand Down Expand Up @@ -1135,6 +1152,23 @@ endif::add-copy-button-to-env-var[]
|string
|

a| [[quarkus-langchain4j-openai_quarkus-langchain4j-openai-model-name-chat-model-strict-json-schema]] [.property-path]##link:#quarkus-langchain4j-openai_quarkus-langchain4j-openai-model-name-chat-model-strict-json-schema[`quarkus.langchain4j.openai."model-name".chat-model.strict-json-schema`]##

[.description]
--
Whether responses follow JSON Schema for Structured Outputs


ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_OPENAI__MODEL_NAME__CHAT_MODEL_STRICT_JSON_SCHEMA+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_OPENAI__MODEL_NAME__CHAT_MODEL_STRICT_JSON_SCHEMA+++`
endif::add-copy-button-to-env-var[]
--
|boolean
|

a| [[quarkus-langchain4j-openai_quarkus-langchain4j-openai-model-name-chat-model-stop]] [.property-path]##link:#quarkus-langchain4j-openai_quarkus-langchain4j-openai-model-name-chat-model-stop[`quarkus.langchain4j.openai."model-name".chat-model.stop`]##

[.description]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,23 @@ endif::add-copy-button-to-env-var[]
|string
|

a| [[quarkus-langchain4j-openai_quarkus-langchain4j-openai-chat-model-strict-json-schema]] [.property-path]##link:#quarkus-langchain4j-openai_quarkus-langchain4j-openai-chat-model-strict-json-schema[`quarkus.langchain4j.openai.chat-model.strict-json-schema`]##

[.description]
--
Whether responses follow JSON Schema for Structured Outputs


ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_OPENAI_CHAT_MODEL_STRICT_JSON_SCHEMA+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_OPENAI_CHAT_MODEL_STRICT_JSON_SCHEMA+++`
endif::add-copy-button-to-env-var[]
--
|boolean
|

a| [[quarkus-langchain4j-openai_quarkus-langchain4j-openai-chat-model-stop]] [.property-path]##link:#quarkus-langchain4j-openai_quarkus-langchain4j-openai-chat-model-stop[`quarkus.langchain4j.openai.chat-model.stop`]##

[.description]
Expand Down Expand Up @@ -1135,6 +1152,23 @@ endif::add-copy-button-to-env-var[]
|string
|

a| [[quarkus-langchain4j-openai_quarkus-langchain4j-openai-model-name-chat-model-strict-json-schema]] [.property-path]##link:#quarkus-langchain4j-openai_quarkus-langchain4j-openai-model-name-chat-model-strict-json-schema[`quarkus.langchain4j.openai."model-name".chat-model.strict-json-schema`]##

[.description]
--
Whether responses follow JSON Schema for Structured Outputs


ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_OPENAI__MODEL_NAME__CHAT_MODEL_STRICT_JSON_SCHEMA+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_OPENAI__MODEL_NAME__CHAT_MODEL_STRICT_JSON_SCHEMA+++`
endif::add-copy-button-to-env-var[]
--
|boolean
|

a| [[quarkus-langchain4j-openai_quarkus-langchain4j-openai-model-name-chat-model-stop]] [.property-path]##link:#quarkus-langchain4j-openai_quarkus-langchain4j-openai-model-name-chat-model-stop[`quarkus.langchain4j.openai."model-name".chat-model.stop`]##

[.description]
Expand Down
187 changes: 187 additions & 0 deletions docs/modules/ROOT/pages/includes/quarkus-langchain4j-tavily.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,193 @@ a| [[quarkus-langchain4j-tavily_quarkus-langchain4j-tavily-exclude-domains]] [.p
A list of domains to specifically exclude from the search results. Default is ++[]++, which doesn't exclude any domains.


ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_TAVILY_EXCLUDE_DOMAINS+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_TAVILY_EXCLUDE_DOMAINS+++`
endif::add-copy-button-to-env-var[]
--
|list of string
|`[]`

a| [[quarkus-langchain4j-tavily_quarkus-langchain4j-tavily-base-url]] [.property-path]##link:#quarkus-langchain4j-tavily_quarkus-langchain4j-tavily-base-url[`quarkus.langchain4j.tavily.base-url`]##

[.description]
--
Base URL of the Tavily API


ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_TAVILY_BASE_URL+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_TAVILY_BASE_URL+++`
endif::add-copy-button-to-env-var[]
--
|string
|`https://api.tavily.com`

a| [[quarkus-langchain4j-tavily_quarkus-langchain4j-tavily-api-key]] [.property-path]##link:#quarkus-langchain4j-tavily_quarkus-langchain4j-tavily-api-key[`quarkus.langchain4j.tavily.api-key`]##

[.description]
--
API key for the Tavily API


ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_TAVILY_API_KEY+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_TAVILY_API_KEY+++`
endif::add-copy-button-to-env-var[]
--
|string
|required icon:exclamation-circle[title=Configuration property is required]

a| [[quarkus-langchain4j-tavily_quarkus-langchain4j-tavily-max-results]] [.property-path]##link:#quarkus-langchain4j-tavily_quarkus-langchain4j-tavily-max-results[`quarkus.langchain4j.tavily.max-results`]##

[.description]
--
Maximum number of results to return


ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_TAVILY_MAX_RESULTS+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_TAVILY_MAX_RESULTS+++`
endif::add-copy-button-to-env-var[]
--
|int
|`5`

a| [[quarkus-langchain4j-tavily_quarkus-langchain4j-tavily-timeout]] [.property-path]##link:#quarkus-langchain4j-tavily_quarkus-langchain4j-tavily-timeout[`quarkus.langchain4j.tavily.timeout`]##

[.description]
--
The timeout duration for Tavily requests.


ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_TAVILY_TIMEOUT+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_TAVILY_TIMEOUT+++`
endif::add-copy-button-to-env-var[]
--
|link:https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html[Duration] link:#duration-note-anchor-{summaryTableId}[icon:question-circle[title=More information about the Duration format]]
|`60S`

a| [[quarkus-langchain4j-tavily_quarkus-langchain4j-tavily-log-requests]] [.property-path]##link:#quarkus-langchain4j-tavily_quarkus-langchain4j-tavily-log-requests[`quarkus.langchain4j.tavily.log-requests`]##

[.description]
--
Whether requests to Tavily should be logged


ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_TAVILY_LOG_REQUESTS+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_TAVILY_LOG_REQUESTS+++`
endif::add-copy-button-to-env-var[]
--
|boolean
|`false`

a| [[quarkus-langchain4j-tavily_quarkus-langchain4j-tavily-log-responses]] [.property-path]##link:#quarkus-langchain4j-tavily_quarkus-langchain4j-tavily-log-responses[`quarkus.langchain4j.tavily.log-responses`]##

[.description]
--
Whether responses from Tavily should be logged


ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_TAVILY_LOG_RESPONSES+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_TAVILY_LOG_RESPONSES+++`
endif::add-copy-button-to-env-var[]
--
|boolean
|`false`

a| [[quarkus-langchain4j-tavily_quarkus-langchain4j-tavily-search-depth]] [.property-path]##link:#quarkus-langchain4j-tavily_quarkus-langchain4j-tavily-search-depth[`quarkus.langchain4j.tavily.search-depth`]##

[.description]
--
The search depth to use. This can be "basic" or "advanced". Basic is the default.


ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_TAVILY_SEARCH_DEPTH+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_TAVILY_SEARCH_DEPTH+++`
endif::add-copy-button-to-env-var[]
--
a|`basic`, `advanced`
|`basic`

a| [[quarkus-langchain4j-tavily_quarkus-langchain4j-tavily-include-answer]] [.property-path]##link:#quarkus-langchain4j-tavily_quarkus-langchain4j-tavily-include-answer[`quarkus.langchain4j.tavily.include-answer`]##

[.description]
--
Include a short answer to original query. Default is false.


ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_TAVILY_INCLUDE_ANSWER+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_TAVILY_INCLUDE_ANSWER+++`
endif::add-copy-button-to-env-var[]
--
|boolean
|`false`

a| [[quarkus-langchain4j-tavily_quarkus-langchain4j-tavily-include-raw-content]] [.property-path]##link:#quarkus-langchain4j-tavily_quarkus-langchain4j-tavily-include-raw-content[`quarkus.langchain4j.tavily.include-raw-content`]##

[.description]
--
Include the cleaned and parsed HTML content of each search result. Default is false.


ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_TAVILY_INCLUDE_RAW_CONTENT+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_TAVILY_INCLUDE_RAW_CONTENT+++`
endif::add-copy-button-to-env-var[]
--
|boolean
|`false`

a| [[quarkus-langchain4j-tavily_quarkus-langchain4j-tavily-include-domains]] [.property-path]##link:#quarkus-langchain4j-tavily_quarkus-langchain4j-tavily-include-domains[`quarkus.langchain4j.tavily.include-domains`]##

[.description]
--
A list of domains to specifically include in the search results. Default is ++[]++, which includes all domains.


ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_TAVILY_INCLUDE_DOMAINS+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_TAVILY_INCLUDE_DOMAINS+++`
endif::add-copy-button-to-env-var[]
--
|list of string
|`[]`

a| [[quarkus-langchain4j-tavily_quarkus-langchain4j-tavily-exclude-domains]] [.property-path]##link:#quarkus-langchain4j-tavily_quarkus-langchain4j-tavily-exclude-domains[`quarkus.langchain4j.tavily.exclude-domains`]##

[.description]
--
A list of domains to specifically exclude from the search results. Default is ++[]++, which doesn't exclude any domains.


ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_TAVILY_EXCLUDE_DOMAINS+++[]
endif::add-copy-button-to-env-var[]
Expand Down
Loading
Loading