Skip to content

feat: add model type autocomplete with api based suggestions and plat…#1204

Merged
bytecii merged 13 commits intoeigent-ai:mainfrom
statxc:feat/model-type-suggestions-combobox
Feb 22, 2026
Merged

feat: add model type autocomplete with api based suggestions and plat…#1204
bytecii merged 13 commits intoeigent-ai:mainfrom
statxc:feat/model-type-suggestions-combobox

Conversation

@statxc
Copy link
Contributor

@statxc statxc commented Feb 9, 2026

Description

Support suggesting model types in model configuration. When configuring an AI model provider, the model type field now shows a searchable dropdown with all available model types from CAMEL enum, filtered by platform. For OpenAI-compatible platforms with an API key, live models are also fetched from the API and merged into suggestions.

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Issue: #1198

@statxc
Copy link
Contributor Author

statxc commented Feb 9, 2026

@lightaime @Wendong-Fan @eureka928 Please review my first PR. I would really appreciate your feedback. Thank you

If api_key is provided for OpenAI-compatible platforms,
also fetches available models from the API.
"""
from camel.types import ModelType
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import at the top of the file

platform_lower = (platform or "").lower().replace("-", "_")
if api_key and platform_lower in openai_like:
try:
import httpx
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

all_model_types = [mt.value for mt in ModelType]

if platform:
platform_lower = platform.lower().replace("-", "_")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems not match with the PLATFORM_PREFIXES for example for the openai

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why we need .replace("-", "_")?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@statxc
Copy link
Contributor Author

statxc commented Feb 10, 2026

@bytecii Thanks for your feedback! I fixed all. Could you please review again?

source = "camel"

# Platform name → model name prefixes for filtering
PLATFORM_PREFIXES: dict[str, list[str]] = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to MODEL_PREFIXES?

all_model_types = [mt.value for mt in ModelType]

if platform:
platform_lower = platform.lower().replace("-", "_")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why we need .replace("-", "_")?

# For OpenAI-compatible platforms with an API key,
# also fetch live models from the API
# Note: platform names are normalized (lowercase, hyphens → underscores)
openai_like = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's define them as types some where?

platform_lower = (platform or "").lower().replace("-", "_")
if api_key and platform_lower in openai_like:
try:
api_base_url = (api_url or "https://api.openai.com/v1").rstrip(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also define the api url as some constants somewhere

.catch((err) => {
console.error('Failed to fetch model type suggestions:', err);
// Cache empty array to avoid retrying on every render
suggestionsCache[cacheKey] = [];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When meet network instability, there is no way to retry.

all_model_types = [mt.value for mt in ModelType]

if platform:
platform_lower = platform.lower().replace("-", "_")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

source = "camel"

# Platform name → model name prefixes for filtering
PLATFORM_PREFIXES: dict[str, list[str]] = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move it to module level?


const stateClasses =
state === 'error'
? 'border-input-border-cuation bg-input-bg-default'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo?

className={cn(
'mt-1.5 !text-body-xs',
state === 'error'
? 'text-text-cuation'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo?

… fix duplicate platform normalization, rename PLATFORM_PREFIXES to MODEL_PREFIXES, fix typos cuation to caution in combobox, and remove error caching to allow network retry
@statxc
Copy link
Contributor Author

statxc commented Feb 11, 2026

@bytecii @Zephyroam Thanks for your feedback. I updated all according to your feedback. could you review again?

@statxc
Copy link
Contributor Author

statxc commented Feb 13, 2026

@Wendong-Fan @bytecii Would you please review this PR? thank you.

@statxc statxc requested review from Zephyroam and bytecii February 16, 2026 14:27
@statxc
Copy link
Contributor Author

statxc commented Feb 17, 2026

@Zephyroam @bytecii please review this PR.

@bytecii
Copy link
Collaborator

bytecii commented Feb 17, 2026

Can you add a screenshot or video to the PR description? Thanks

@statxc statxc force-pushed the feat/model-type-suggestions-combobox branch from 3572e99 to 9c8de4f Compare February 18, 2026 12:03
@statxc
Copy link
Contributor Author

statxc commented Feb 18, 2026

1.mp4

@bytecii I attached test video. Please review again. Thank you

@lightaime
Copy link
Contributor

@intelliking is it possible to rank the models from newer to older. Also @Wendong-Fan, it seems lots of models are deprecated from the model providers. Should we remove them from the CAMEL side?

@statxc
Copy link
Contributor Author

statxc commented Feb 20, 2026

@lightaime I have updated to follow your feedback. please check again

@Wendong-Fan
Copy link
Contributor

@intelliking is it possible to rank the models from newer to older. Also @Wendong-Fan, it seems lots of models are deprecated from the model providers. Should we remove them from the CAMEL side?

issue in camel: camel-ai/camel#3868

@bytecii
Copy link
Collaborator

bytecii commented Feb 22, 2026

image Fixed some bugs and here is an example

@bytecii bytecii merged commit a0b2d5d into eigent-ai:main Feb 22, 2026
7 checks passed
bitloi pushed a commit to bitloi/eigent that referenced this pull request Feb 22, 2026
@statxc statxc deleted the feat/model-type-suggestions-combobox branch February 22, 2026 11:37
@Wendong-Fan
Copy link
Contributor

Wendong-Fan commented Feb 23, 2026

some bug introduced by this PR, i will revert for now

Screenshot 2026-02-24 at 02 01 46

@Wendong-Fan
Copy link
Contributor

also seems now only support choosing model from the list, could we also allow user type in the model naming?

@bytecii
Copy link
Collaborator

bytecii commented Feb 24, 2026

@Wendong-Fan the fixes and improvements here #1355

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Support suggesting model type setting in model configuration

5 participants