mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-09 15:19:10 +02:00
Add "High Value" Ruff Rules (#2255)
* Safe Fixes from ruff * Fix remaining issues * lint/check * Fix mysterious ty check errors * small cleanup * pr fixes
This commit is contained in:
parent
e74918a544
commit
9d4c378e1b
65 changed files with 340 additions and 333 deletions
|
|
@ -7,14 +7,14 @@ from ._read import fetch_notifications, fetch_timeline, search_for_posts
|
|||
from ._social import follow_user_by_handle, like_post_by_uri, repost_by_uri
|
||||
|
||||
__all__ = [
|
||||
"get_client",
|
||||
"get_profile_info",
|
||||
"create_post",
|
||||
"create_thread",
|
||||
"fetch_timeline",
|
||||
"search_for_posts",
|
||||
"fetch_notifications",
|
||||
"fetch_timeline",
|
||||
"follow_user_by_handle",
|
||||
"get_client",
|
||||
"get_profile_info",
|
||||
"like_post_by_uri",
|
||||
"repost_by_uri",
|
||||
"search_for_posts",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,3 +1,9 @@
|
|||
# /// script
|
||||
# dependencies = ["aiohttp", "fastmcp"]
|
||||
# ///
|
||||
|
||||
# uv pip install aiohttp fastmcp
|
||||
|
||||
import aiohttp
|
||||
|
||||
from fastmcp.server import FastMCP
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ from typing import Annotated, Any, Self
|
|||
import asyncpg
|
||||
import numpy as np
|
||||
from openai import AsyncOpenAI
|
||||
from pgvector.asyncpg import register_vector # Import register_vector
|
||||
from pgvector.asyncpg import register_vector
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic_ai import Agent
|
||||
|
||||
|
|
@ -149,7 +149,9 @@ class MemoryNode(BaseModel):
|
|||
)
|
||||
self.importance += other.importance
|
||||
self.access_count += other.access_count
|
||||
self.embedding = [(a + b) / 2 for a, b in zip(self.embedding, other.embedding)]
|
||||
self.embedding = [
|
||||
(a + b) / 2 for a, b in zip(self.embedding, other.embedding, strict=True)
|
||||
]
|
||||
self.summary = await do_ai(
|
||||
self.content, "Summarize the following text concisely.", str, deps
|
||||
)
|
||||
|
|
@ -281,9 +283,9 @@ async def display_memory_tree(deps: Deps) -> str:
|
|||
|
||||
@mcp.tool
|
||||
async def remember(
|
||||
contents: list[str] = Field(
|
||||
description="List of observations or memories to store"
|
||||
),
|
||||
contents: Annotated[
|
||||
list[str], Field(description="List of observations or memories to store")
|
||||
],
|
||||
):
|
||||
deps = Deps(openai=AsyncOpenAI(), pool=await get_db_pool())
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue