-
Notifications
You must be signed in to change notification settings - Fork 38
Plugin updates #69
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
Plugin updates #69
Conversation
* Added embedding search feature for utcp 1.0 * Update plugins/tool_search/embedding/pyproject.toml Co-authored-by: Copilot <[email protected]> * Update plugins/tool_search/embedding/README.md Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> * To be resolve * folder structure to be resolved * Correct folder placement done. * Description for values accepted by model_name * Resolved cubic suggestions * Update plugins/tool_search/in_mem_embeddings/tests/test_in_mem_embeddings_search.py Co-authored-by: Copilot <[email protected]> * No change in core for implementing a plugin --------- Co-authored-by: Razvan Radulescu <[email protected]> Co-authored-by: Salman Mohammed <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* Add auth_tools field for selective authentication in OpenAPI tool generation - Add auth_tools field to HttpCallTemplate for tool-specific authentication - Implement compatibility checking between OpenAPI security schemes and auth_tools - Apply real credentials when compatible, use placeholders when incompatible - Preserve existing behavior for public endpoints (no auth required) - Add comprehensive test coverage for all authentication scenarios - Update documentation with auth_tools examples and usage - Maintain full backward compatibility * Update implementation files and documentation for auth_tools feature - Update HttpCallTemplate, HttpCommunicationProtocol, and OpenApiConverter - Add auth_tools examples to README.md - Update existing tests for new auth_tools parameter - Add integration test for auth_tools field functionality * fix: resolve pytest fixture dependency issue in HTTP tests - Fix aiohttp_client fixture usage by properly injecting app dependency - Ensure all test fixtures receive required parameters correctly - All 153 tests now pass without fixture conflicts * feat: add auth_tools support to text plugin - Add auth_tools field to TextCallTemplate for OpenAPI-generated tools - Pass auth_tools to OpenApiConverter when processing local OpenAPI specs - Update documentation to reflect new authentication capabilities - Add test coverage for auth_tools functionality - Maintains backward compatibility (auth_tools is optional) This allows text plugin to apply authentication to tools generated from local OpenAPI specifications, enabling secure API calls while keeping file access authentication-free. * fix: add proper serialization/validation for auth and auth_tools fields - Add field_serializer and field_validator for auth_tools in TextCallTemplate - Add field_serializer and field_validator for both auth and auth_tools in HttpCallTemplate - Use AuthSerializer.validate_dict() for proper dict-to-Auth conversion - Add comprehensive test coverage for auth_tools serialization - Ensures dict configurations preserve all critical authentication fields - All 155 tests pass with proper field validation * Update README.md --------- Co-authored-by: Razvan Radulescu <[email protected]>
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.
10 issues found across 19 files
Prompt for AI agents (all 10 issues)
Understand the root cause of the following 10 issues and fix them.
<file name="plugins/tool_search/in_mem_embeddings/tests/test_plugin.py">
<violation number="1" location="plugins/tool_search/in_mem_embeddings/tests/test_plugin.py:106">
Incorrect exit code logic: script exits with code 1 on success because test_plugin returns None.</violation>
</file>
<file name="plugins/tool_search/in_mem_embeddings/tests/test_performance.py">
<violation number="1" location="plugins/tool_search/in_mem_embeddings/tests/test_performance.py:11">
Incorrect plugin src path; points to non-existent tests/src and will break imports.</violation>
<violation number="2" location="plugins/tool_search/in_mem_embeddings/tests/test_performance.py:12">
Incorrect core src path; does not reach repo root, causing import failures for utcp.*</violation>
<violation number="3" location="plugins/tool_search/in_mem_embeddings/tests/test_performance.py:103">
Incorrect exit logic; script exits with 1 even when test passes because the async test returns None.</violation>
</file>
<file name="plugins/communication_protocols/http/src/utcp_http/openapi_converter.py">
<violation number="1" location="plugins/communication_protocols/http/src/utcp_http/openapi_converter.py:230">
OAuth2 compatibility check is too permissive; token_url (at minimum) should be compared before accepting auth_tools.</violation>
</file>
<file name="README.md">
<violation number="1" location="README.md:483">
auth_tools is not applicable to Text call templates; this may mislead users or cause validation issues. Remove this block from the Text example.</violation>
</file>
<file name="plugins/tool_search/in_mem_embeddings/src/utcp_in_mem_embeddings/in_mem_embeddings_search.py">
<violation number="1" location="plugins/tool_search/in_mem_embeddings/src/utcp_in_mem_embeddings/in_mem_embeddings_search.py:87">
Fixed 384-dim zero vector for empty text can mismatch model embedding dimensions, producing erroneous 0 similarities.</violation>
</file>
<file name="plugins/communication_protocols/http/src/utcp_http/http_call_template.py">
<violation number="1" location="plugins/communication_protocols/http/src/utcp_http/http_call_template.py:111">
Redundant serializer for 'auth' duplicates base CallTemplate logic; prefer relying on the base serializer to avoid duplication.</violation>
<violation number="2" location="plugins/communication_protocols/http/src/utcp_http/http_call_template.py:118">
Redundant validator for 'auth' duplicates base CallTemplate logic; remove or rely on base to keep a single source of truth.</violation>
</file>
<file name="plugins/communication_protocols/http/tests/test_openapi_converter.py">
<violation number="1" location="plugins/communication_protocols/http/tests/test_openapi_converter.py:40">
Avoid live network calls in tests; mock or fixture the OpenAPI spec to improve test reliability.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai
to give feedback, ask questions, or re-run the review.
|
||
if __name__ == "__main__": | ||
success = asyncio.run(test_plugin()) | ||
sys.exit(0 if success else 1) |
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.
Incorrect exit code logic: script exits with code 1 on success because test_plugin returns None.
Prompt for AI agents
Address the following comment on plugins/tool_search/in_mem_embeddings/tests/test_plugin.py at line 106:
<comment>Incorrect exit code logic: script exits with code 1 on success because test_plugin returns None.</comment>
<file context>
@@ -0,0 +1,106 @@
+
+if __name__ == "__main__":
+ success = asyncio.run(test_plugin())
+ sys.exit(0 if success else 1)
</file context>
✅ Addressed in f378e67
|
||
if __name__ == "__main__": | ||
success = asyncio.run(test_performance()) | ||
sys.exit(0 if success else 1) |
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.
Incorrect exit logic; script exits with 1 even when test passes because the async test returns None.
Prompt for AI agents
Address the following comment on plugins/tool_search/in_mem_embeddings/tests/test_performance.py at line 103:
<comment>Incorrect exit logic; script exits with 1 even when test passes because the async test returns None.</comment>
<file context>
@@ -0,0 +1,103 @@
+
+if __name__ == "__main__":
+ success = asyncio.run(test_performance())
+ sys.exit(0 if success else 1)
</file context>
✅ Addressed in f378e67
plugins/tool_search/in_mem_embeddings/tests/test_performance.py
Outdated
Show resolved
Hide resolved
plugins/tool_search/in_mem_embeddings/tests/test_performance.py
Outdated
Show resolved
Hide resolved
async def _get_text_embedding(self, text: str) -> np.ndarray: | ||
"""Generate embedding for given text.""" | ||
if not text: | ||
return np.zeros(384) # Default dimension for all-MiniLM-L6-v2 |
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.
Fixed 384-dim zero vector for empty text can mismatch model embedding dimensions, producing erroneous 0 similarities.
Prompt for AI agents
Address the following comment on plugins/tool_search/in_mem_embeddings/src/utcp_in_mem_embeddings/in_mem_embeddings_search.py at line 87:
<comment>Fixed 384-dim zero vector for empty text can mismatch model embedding dimensions, producing erroneous 0 similarities.</comment>
<file context>
@@ -0,0 +1,241 @@
+ async def _get_text_embedding(self, text: str) -> np.ndarray:
+ """Generate embedding for given text."""
+ if not text:
+ return np.zeros(384) # Default dimension for all-MiniLM-L6-v2
+
+ if self._embedding_model is None:
</file context>
return None | ||
return AuthSerializer().to_dict(auth) | ||
|
||
@field_validator('auth', mode='before') |
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.
Redundant validator for 'auth' duplicates base CallTemplate logic; remove or rely on base to keep a single source of truth.
Prompt for AI agents
Address the following comment on plugins/communication_protocols/http/src/utcp_http/http_call_template.py at line 118:
<comment>Redundant validator for 'auth' duplicates base CallTemplate logic; remove or rely on base to keep a single source of truth.</comment>
<file context>
@@ -96,10 +103,49 @@ class HttpCallTemplate(CallTemplate):
+ return None
+ return AuthSerializer().to_dict(auth)
+
+ @field_validator('auth', mode='before')
+ @classmethod
+ def validate_auth(cls, v: Any) -> Optional[Auth]:
</file context>
✅ Addressed in f378e67
body_field: Optional[str] = Field(default="body", description="The name of the single input field to be sent as the request body.") | ||
header_fields: Optional[List[str]] = Field(default=None, description="List of input fields to be sent as request headers.") | ||
|
||
@field_serializer('auth') |
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.
Redundant serializer for 'auth' duplicates base CallTemplate logic; prefer relying on the base serializer to avoid duplication.
Prompt for AI agents
Address the following comment on plugins/communication_protocols/http/src/utcp_http/http_call_template.py at line 111:
<comment>Redundant serializer for 'auth' duplicates base CallTemplate logic; prefer relying on the base serializer to avoid duplication.</comment>
<file context>
@@ -96,10 +103,49 @@ class HttpCallTemplate(CallTemplate):
body_field: Optional[str] = Field(default="body", description="The name of the single input field to be sent as the request body.")
header_fields: Optional[List[str]] = Field(default=None, description="List of input fields to be sent as request headers.")
+ @field_serializer('auth')
+ def serialize_auth(self, auth: Optional[Auth]) -> Optional[dict]:
+ """Serialize auth to dictionary."""
</file context>
✅ Addressed in f378e67
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Summary by cubic
Adds selective authentication for OpenAPI-generated tools via a new auth_tools field and introduces an in-memory embeddings tool search plugin for semantic matching.
New Features
Bug Fixes