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
| import asyncio | |
| from typing import List, Dict | |
| class AdvancedCodeAssistant(CodeAssistant): | |
| """Enhanced with parallel tool execution""" | |
| async def search_codebase(self, query: str) -> List[Dict]: | |
| """Search entire codebase""" | |
| return self.retrieve_context(query, k=5) |
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
| import os | |
| import anthropic | |
| from pathlib import Path | |
| import tiktoken | |
| import numpy as np | |
| from sklearn.metrics.pairwise import cosine_similarity | |
| import faiss | |
| import openai | |
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
| import asyncio | |
| import json | |
| import sys | |
| from typing import Optional, List | |
| from contextlib import AsyncExitStack | |
| from mcp import ClientSession, StdioServerParameters | |
| from mcp.client.stdio import stdio_client | |
| import ollama | |
| from dotenv import load_dotenv |
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
| """ | |
| MCP Observability Server | |
| A Model Context Protocol server for observability and monitoring systems. | |
| """ | |
| import asyncio | |
| import json | |
| import logging | |
| import random | |
| import time |
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
| import asyncio | |
| import json | |
| from typing import Optional | |
| from contextlib import AsyncExitStack | |
| from dotenv import load_dotenv | |
| from mcp import ClientSession, StdioServerParameters | |
| from mcp.client.stdio import stdio_client | |
| import ollama |
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
| import datetime | |
| from mcp.server.fastmcp import FastMCP | |
| mcp = FastMCP("mcp-excel-server") | |
| @mcp.tool() | |
| def get_datetime() -> datetime.datetime: | |
| """Use this tool when the user wants to know today's date.""" |
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
| """ | |
| Source: https://github.com/modelcontextprotocol/quickstart-resources/blob/main/weather-server-python/weather.py | |
| """ | |
| rom typing import Any | |
| import httpx | |
| from mcp.server.fastmcp import FastMCP | |
| # Initialize FastMCP server | |
| mcp = FastMCP("weather") |
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
| def build_tsmixer_model(input_shape, forecast_horizon=1, hidden_dim=128, num_layers=2): | |
| inputs = Input(shape=input_shape) | |
| x = inputs | |
| # Time mixing layers | |
| for _ in range(num_layers): | |
| # Mix across time dimension | |
| time_mix = tf.keras.layers.Permute((2, 1))(x) # [batch, features, time] | |
| time_mix = Dense(input_shape[0], activation='relu')(time_mix) # Project each feature across time | |
| time_mix = tf.keras.layers.Permute((2, 1))(time_mix) # Back to [batch, time, features] |
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
| def build_tft_model(static_shape, past_shape, future_shape, forecast_horizon): | |
| static_inputs = Input(shape=static_shape) | |
| past_inputs = Input(shape=past_shape) | |
| future_inputs = Input(shape=future_shape) # Known future covariates | |
| static_context = Dense(64, activation='relu')(static_inputs) | |
| past_selected = Dense(past_shape[-1], activation='sigmoid')(tf.concat([past_inputs, static_context], axis=-1)) | |
| past_weighted = past_inputs * past_selected | |
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
| def create_patches(x, patch_len, stride=1): | |
| """Convert time series data into patches""" | |
| patches = [] | |
| for i in range(0, x.shape[1] - patch_len + 1, stride): | |
| patches.append(x[:, i:i+patch_len, :]) | |
| # Stack patches along a new dimension | |
| patches = tf.stack(patches, axis=1) | |
| # Reshape to [batch, num_patches, patch_len * channels] |
NewerOlder