Skip to content
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
2 changes: 1 addition & 1 deletion api/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "api"
version = "0.59.9"
version = "0.59.10"
description = "Agenta API"
authors = [
{ name = "Mahmoud Mabrouk", email = "[email protected]" },
Expand Down
2 changes: 1 addition & 1 deletion sdk/agenta/sdk/utils/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from threading import Lock

CACHE_CAPACITY = int(getenv("AGENTA_MIDDLEWARE_CACHE_CAPACITY", "512"))
CACHE_TTL = int(getenv("AGENTA_MIDDLEWARE_CACHE_TTL", str(5 * 60))) # 5 minutes
CACHE_TTL = int(getenv("AGENTA_MIDDLEWARE_CACHE_TTL", str(1 * 60))) # 1 minutes


class TTLLRUCache:
Expand Down
2 changes: 1 addition & 1 deletion sdk/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "agenta"
version = "0.59.9"
version = "0.59.10"
description = "The SDK for agenta is an open-source LLMOps platform."
readme = "README.md"
authors = [
Expand Down
2 changes: 1 addition & 1 deletion web/ee/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agenta/ee",
"version": "0.59.9",
"version": "0.59.10",
"private": true,
"engines": {
"node": ">=18"
Expand Down
2 changes: 1 addition & 1 deletion web/oss/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agenta/oss",
"version": "0.59.9",
"version": "0.59.10",
"private": true,
"engines": {
"node": ">=18"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import SelectLLMProvider from "@/oss/components/SelectLLMProvider"
import {useVaultSecret} from "@/oss/hooks/useVaultSecret"
import {LlmProvider} from "@/oss/lib/helpers/llmProviders"
import {isAppNameInputValid} from "@/oss/lib/helpers/utils"
import {SecretDTOProvider} from "@/oss/lib/Types"
import {PROVIDER_KINDS, PROVIDER_LABELS, SecretDTOProvider} from "@/oss/lib/Types"

import LabelInput from "../../../assets/LabelInput"

Expand Down Expand Up @@ -109,12 +109,28 @@ const ConfigureProviderDrawerContent = ({
[standardProviders, customProviders],
)

const providerValue = useWatch("provider", form)?.toLowerCase() || ""
const shouldFilter = validProviders.includes(providerValue)
const providerValue = useWatch("provider", form) || ""
const normalizedProviderKind = useMemo(() => {
if (!providerValue || typeof providerValue !== "string") {
return ""
}

const trimmedValue = providerValue.trim()
const lowerCaseValue = trimmedValue.toLowerCase()

return PROVIDER_KINDS[trimmedValue] ?? PROVIDER_KINDS[lowerCaseValue] ?? lowerCaseValue
}, [providerValue])

const shouldFilter = validProviders.includes(normalizedProviderKind)

useEffect(() => {
if (selectedProvider) {
form.setFieldsValue(selectedProvider)
form.setFieldsValue({
...selectedProvider,
provider: selectedProvider.provider
? (PROVIDER_LABELS[selectedProvider.provider] ?? selectedProvider.provider)
: selectedProvider.provider,
})
} else {
form.resetFields()
}
Expand Down Expand Up @@ -177,7 +193,7 @@ const ConfigureProviderDrawerContent = ({

{PROVIDER_FIELDS.filter((field) => {
if (shouldFilter) {
return !field.model || field.model.includes(providerValue)
return !field.model || field.model.includes(normalizedProviderKind)
}
return true
}).map((rawField) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const SecretProviderTable = ({type}: {type: "standard" | "custom"}) => {
style: {minWidth: 160},
}),
render: (_, record) => {
const Icon = LLMIcons[(record.title as string)]
const Icon = LLMIcons[record.title as string]

return isCustom ? (
record?.name
Expand Down
9 changes: 9 additions & 0 deletions web/oss/src/lib/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,15 @@ export const PROVIDER_LABELS: Record<string, string> = {
custom: "Custom Provider",
}

export const PROVIDER_KINDS: Record<string, string> = Object.entries(PROVIDER_LABELS).reduce(
(acc, [kind, label]) => {
acc[kind] = kind
acc[label.toLowerCase()] = kind
return acc
},
{} as Record<string, string>,
)

interface VaultModels {
slug: string
}
Expand Down
11 changes: 9 additions & 2 deletions web/oss/src/lib/helpers/llmProviders.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {StandardSecretDTO, CustomSecretDTO, SecretDTOKind} from "../Types"
import {StandardSecretDTO, CustomSecretDTO, SecretDTOKind, PROVIDER_KINDS} from "../Types"

export const llmAvailableProvidersToken = "llmAvailableProvidersToken"

Expand Down Expand Up @@ -98,6 +98,13 @@ export const llmAvailableProviders: LlmProvider[] = [
]

export const transformCustomProviderPayloadData = (values: LlmProvider) => {
const providerInput = values.provider?.trim() ?? ""
const providerKind = providerInput
? (PROVIDER_KINDS[providerInput] ??
PROVIDER_KINDS[providerInput.toLowerCase()] ??
providerInput.toLowerCase())
: ""

return {
header: {
name: values.name,
Expand All @@ -106,7 +113,7 @@ export const transformCustomProviderPayloadData = (values: LlmProvider) => {
secret: {
kind: SecretDTOKind.CUSTOM_PROVIDER_KEY,
data: {
kind: values.provider?.toLowerCase(),
kind: providerKind,
provider: {
url: values.apiBaseUrl,
version: values.version,
Expand Down
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "agenta-web",
"version": "0.59.9",
"version": "0.59.10",
"workspaces": [
"ee",
"oss",
Expand Down