-
Notifications
You must be signed in to change notification settings - Fork 931
feat(memory-store,agents-api): Add special foreign fields to usage table #1480
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
base: dev
Are you sure you want to change the base?
Conversation
Signed-off-by: Diwank Singh Tomer <diwank.singh@gmail.com>
CI Feedback 🧐(Feedback updated until commit 832f644)A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
|
params = { | ||
"messages": messages, | ||
"tools": formatted_tools or None, | ||
"user": str(developer.id), | ||
"tags": developer.tags, | ||
"custom_api_key": x_custom_api_key, | ||
"session_id": session_id, |
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.
entry_id
isn't being passed.
ADD COLUMN session_id UUID NULL, | ||
ADD COLUMN execution_id UUID NULL, | ||
ADD COLUMN transition_id UUID NULL, | ||
ADD COLUMN entry_id UUID NULL, | ||
ADD COLUMN provider TEXT NULL; |
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.
entry_id
and transition_id
would be enough, though it's not that bad to add them as fields as well.
custom_api_used: bool = False, | ||
estimated: bool = False, | ||
metadata: dict[str, Any] | None = None, | ||
session_id: UUID | None = None, | ||
execution_id: UUID | None = None, | ||
transition_id: UUID | None = None, | ||
entry_id: UUID | None = None, | ||
provider: str | None = None, |
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.
a lot of variables, better to create a model in typespec to clean up the parameters.
"input_messages": messages, | ||
"output_content": [ | ||
choice.message.content | ||
for choice in response.choices | ||
if hasattr(choice, "message") | ||
and choice.message | ||
and hasattr(choice.message, "content") | ||
] |
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.
adding all messages to the metadata adds a huge unnecessary memory overhead to the usage table.
def extract_provider_from_model(model: str) -> str | None: | ||
""" | ||
Extract the provider from a model name. | ||
|
||
Args: | ||
model (str): The model name (e.g., "gpt-4", "claude-3-sonnet", "openai/gpt-4") | ||
|
||
Returns: | ||
str | None: The provider name (e.g., "openai", "anthropic") or None if unknown |
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.
not sure about the functionality of this function. Litellm in general with a self-hosted proxy acts very weirdly towards providers. A better way I think is to determine the provider by the api key provided in the litellm-config.
Signed-off-by: Diwank Singh Tomer diwank.singh@gmail.com