-
Notifications
You must be signed in to change notification settings - Fork 0
[PD1-668] Add ability to add agent post #16
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5602421
feat: add ability to push agent posts
amy-nihao cf7f01b
feat: add tags to request and rename recommendation type
amy-nihao 179d173
chore: remove unused type definition
amy-nihao a91dd01
Merge branch 'main' into amy/add-agent-post
amy-nihao 4595a0b
fix: lint fix
amy-nihao c92f350
fix: fix type definitions
amy-nihao 575b733
fix: remove old types + add pydantic model
amy-nihao 0af365e
Merge branch 'amy/add-agent-post' of https://github.com/CVector-Energ…
amy-nihao 578b01a
fix: lint fix
amy-nihao fac4454
fix: ruff fix
amy-nihao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import os | ||
| import uuid | ||
|
|
||
| from cvec import CVec | ||
| from cvec.models.agent_post import AgentPostRecommendation, AgentPostTag, Severity | ||
|
|
||
|
|
||
| def main() -> None: | ||
| # Initialize CVec client | ||
| cvec = CVec( | ||
| host=os.environ.get("CVEC_HOST", "https://your-subdomain.cvector.dev"), | ||
| api_key=os.environ.get("CVEC_API_KEY", "your-api-key"), | ||
| ) | ||
|
|
||
| recommendations = [ | ||
| AgentPostRecommendation( | ||
| content="Critical recommendation", | ||
| severity=Severity.CRITICAL, | ||
| ), | ||
| AgentPostRecommendation( | ||
| content="Warning recommendation", | ||
| severity=Severity.WARNING, | ||
| ), | ||
| AgentPostRecommendation( | ||
| content="Info recommendation", | ||
| severity=Severity.INFO, | ||
| ), | ||
| ] | ||
|
|
||
| tags = [ | ||
| AgentPostTag( | ||
| content="urgent", | ||
| severity=Severity.CRITICAL, | ||
| ), | ||
| AgentPostTag( | ||
| content="monitoring", | ||
| severity=Severity.INFO, | ||
| ), | ||
| ] | ||
|
|
||
| cvec.add_agent_post( | ||
| title="Test post", | ||
| author="Operational Agent", | ||
| image_id=str(uuid.uuid4()), # Replace with actual image UUID uploaded to S3 | ||
| content="SDK add post test.", | ||
| recommendations=recommendations, | ||
| tags=tags, | ||
| ) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,24 @@ | ||
| from .agent_post import ( | ||
| AgentPost, | ||
| AgentPostRecommendation, | ||
| AgentPostTag, | ||
| Severity, | ||
| ) | ||
| from .eav_column import EAVColumn | ||
| from .eav_filter import EAVFilter | ||
| from .eav_table import EAVTable | ||
| from .metric import Metric, MetricDataPoint | ||
| from .span import Span | ||
|
|
||
| __all__ = [ | ||
| "AgentPost", | ||
| "AgentPostRecommendation", | ||
| "AgentPostTag", | ||
| "EAVColumn", | ||
| "EAVFilter", | ||
| "EAVTable", | ||
| "Metric", | ||
| "MetricDataPoint", | ||
| "Severity", | ||
| "Span", | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| from enum import Enum | ||
| from typing import List, Optional | ||
|
|
||
| from pydantic import BaseModel, Field | ||
|
|
||
|
|
||
| class Severity(str, Enum): | ||
| """Severity level for recommendations and tags.""" | ||
|
|
||
| CRITICAL = "critical" | ||
| WARNING = "warning" | ||
| INFO = "info" | ||
|
|
||
|
|
||
| class AgentPostRecommendation(BaseModel): | ||
| """ | ||
| Represents a recommendation for creating an agent post. | ||
| """ | ||
|
|
||
| content: str = Field(..., min_length=1) | ||
| severity: Severity | ||
|
|
||
|
|
||
| class AgentPostTag(BaseModel): | ||
| """ | ||
| Represents a tag for creating an agent post. | ||
| """ | ||
|
|
||
| content: str = Field(..., min_length=1) | ||
| severity: Severity | ||
|
|
||
|
|
||
| class AgentPost(BaseModel): | ||
| """ | ||
| Represents an agent post with optional recommendations and tags. | ||
| """ | ||
|
|
||
| author: str | ||
| title: str | ||
| content: Optional[str] = None | ||
| image_id: Optional[str] = None | ||
| recommendations: Optional[List[AgentPostRecommendation]] = None | ||
| tags: Optional[List[AgentPostTag]] = None | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.