-
Notifications
You must be signed in to change notification settings - Fork 218
Support content moderation requests and moderating models (for Ollama, OpenAI, and Bedrock) #395
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
Conversation
719eb00
to
954588e
Compare
...rc/commonTest/kotlin/ai/koog/agents/core/dsl/extension/AIAgentNodesHistoryCompressionTest.kt
Outdated
Show resolved
Hide resolved
...sts/src/jvmTest/kotlin/ai/koog/integration/tests/MultipleLLMPromptExecutorIntegrationTest.kt
Outdated
Show resolved
Hide resolved
...sts/src/jvmTest/kotlin/ai/koog/integration/tests/MultipleLLMPromptExecutorIntegrationTest.kt
Outdated
Show resolved
Hide resolved
integration-tests/src/jvmTest/kotlin/ai/koog/integration/tests/OllamaClientIntegrationTest.kt
Outdated
Show resolved
Hide resolved
...all/src/jvmTest/kotlin/ai/koog/prompt/executor/llms/all/MultipleLLMPromptExecutorMockTest.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, look good for me. I would update test data and rebased onto a new develop
branch to fix compilation.
prompt/prompt-model/src/commonMain/kotlin/ai/koog/prompt/dsl/ModerationAPI.kt
Outdated
Show resolved
Hide resolved
.../prompt-executor-model/src/commonMain/kotlin/ai/koog/prompt/executor/model/PromptExecutor.kt
Outdated
Show resolved
Hide resolved
...xecutor-llms/src/commonTest/kotlin/ai/koog/prompt/executor/llms/LLMPromptExecutorMockTest.kt
Show resolved
Hide resolved
logger.debug { "Moderating multi-modal content with model: ${model.id}" } | ||
|
||
val provider = model.provider | ||
val client = llmClients[provider] ?: throw IllegalArgumentException("No client found for provider: $provider") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about extracting this check into a separate function and generalize the error? Similar code is used in other methods above.
...client/src/commonMain/kotlin/ai/koog/prompt/executor/clients/anthropic/AnthropicLLMClient.kt
Outdated
Show resolved
Hide resolved
...r-openai-client/src/commonMain/kotlin/ai/koog/prompt/executor/clients/openai/OpenAIModels.kt
Show resolved
Hide resolved
integration-tests/src/jvmTest/kotlin/ai/koog/integration/tests/OllamaClientIntegrationTest.kt
Show resolved
Hide resolved
.../prompt-executor-model/src/commonMain/kotlin/ai/koog/prompt/executor/model/PromptExecutor.kt
Show resolved
Hide resolved
...ry/src/jvmMain/kotlin/ai/koog/agents/features/opentelemetry/event/ModerationResponseEvent.kt
Outdated
Show resolved
Hide resolved
...ry/src/jvmMain/kotlin/ai/koog/agents/features/opentelemetry/event/ModerationResponseEvent.kt
Outdated
Show resolved
Hide resolved
@Ololoshechkin , btw, it looks like Mistral has Moderation API already as well - https://docs.mistral.ai/capabilities/guardrailing/ |
prompt/prompt-model/src/commonMain/kotlin/ai/koog/prompt/dsl/ModerationAPI.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a few mosly style related comments
prompt/prompt-model/src/commonMain/kotlin/ai/koog/prompt/message/Message.kt
Outdated
Show resolved
Hide resolved
.../prompt-executor-model/src/commonMain/kotlin/ai/koog/prompt/executor/model/PromptExecutor.kt
Show resolved
Hide resolved
prompt/prompt-model/src/commonMain/kotlin/ai/koog/prompt/dsl/ModerationAPI.kt
Show resolved
Hide resolved
...client/src/commonMain/kotlin/ai/koog/prompt/executor/clients/openai/OpenAIModerationInput.kt
Outdated
Show resolved
Hide resolved
@sdubov thanks, will apply your suggestions. |
9e7bdb5
to
fce56cd
Compare
fce56cd
to
4f249e1
Compare
Qodana for JVM446 new problems were found
@@ Code coverage @@
+ 63% total lines covered
7835 lines analyzed, 5003 lines covered
# Calculated according to the filters of your coverage tool ☁️ View the detailed Qodana report Contact Qodana teamContact us at [email protected]
|
Fixes: #396
Type of the change
Checklist for all pull requests
develop
as the base branchAdditional steps for pull requests adding a new feature