Skip to content

Instantly share code, notes, and snippets.

View koganei's full-sized avatar

Marc Khoury koganei

View GitHub Profile
@koganei
koganei / CustomAgent.py
Last active April 16, 2023 15:52
Adding Post-Processing Pipeline to Haystack Agents
class CustomAgent(Agent):
# Post-Processing Pipeline
def __init__(self, **kwargs):
super().__init__(**kwargs)
def add_post_processing_pipeline(self, pipeline):
self.post_processing_pipeline = pipeline
self.callback_manager.on_agent_finish += self.on_result_post_process
@koganei
koganei / main.py
Created May 5, 2023 21:03
Websocket Support for Haystack Agent
import asyncio
import sys
import threading
from typing import Any
import json
import os
import logging
from fastapi import FastAPI, WebSocket, BackgroundTasks, WebSocketDisconnect
from fastapi.responses import HTMLResponse
from functools import partial