Skip to content

Conversation

wilsonccccc
Copy link
Contributor

No description provided.

@wilsonccccc wilsonccccc requested a review from lingtonglu August 9, 2025 23:59
def _get_or_create_adapter(self, provider_name: str, base_url: str | None = None, config: dict[str, Any] | None = None) -> ProviderAdapter:
"""Get an adapter instance from cache or create a new one"""
# Create a cache key that includes provider name, base_url, and config hash
config_hash = hash(frozenset((config or {}).items()))
Copy link
Contributor

Choose a reason for hiding this comment

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

Write a dedicated function in the cache file to create/get/invalidate such cache

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh wait, it's not an actual "cache". NVM, this should be good

f"Cached models for provider {provider_name} (TTL: {cls._models_cache_ttl}s)"
)

def _get_adapters(self) -> dict[str, ProviderAdapter]:
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see any usage of such function. I think we could remove it.

Also, in the init function, we do self.adapters = self._get_adapters(). It's not needed as we don't use the member variable adapters

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants