Skip to content

Commit

Permalink
update .gitignore to include pipeline files
Browse files Browse the repository at this point in the history
  • Loading branch information
ali-moha committed Nov 5, 2024
1 parent 1fa96c0 commit aa46981
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ __pycache__


pipelines/*
!pipelines/*.*
!pipelines/.gitignore
.DS_Store

.venv
venv/
venv/
__pycache__
52 changes: 52 additions & 0 deletions pipelines/first_pipeline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"""
title: Haystack Pipeline
author: open-webui
date: 2024-05-30
version: 1.0
license: MIT
description: A pipeline for retrieving relevant information from a knowledge base using the Haystack library.
requirements: haystack-ai, datasets>=2.6.1, sentence-transformers>=2.2.0
"""

from typing import List, Union, Generator, Iterator, Optional
from schemas import OpenAIChatMessage


class Pipeline:
def __init__(self):
self.chat_id = None
pass

async def on_startup(self):
pass

async def on_shutdown(self):
# This function is called when the server is stopped.
pass

async def inlet(self, body: dict, user: Optional[dict] = None) -> dict:
print(f"inlet:{__name__}")
print(f"user: {user}")
print(f"body: {body}")
# Store the chat_id from body
self.chat_id = body.get("chat_id")
print(f"Stored chat_id: {self.chat_id}")

return body

def pipe(
self, user_message: str, model_id: str, messages: List[dict], body: dict
) -> Union[str, Generator, Iterator]:
# This is where you can add your custom RAG pipeline.
# Typically, you would retrieve relevant information from your knowledge base and synthesize it to generate a response.

print("Body is: ")
print(body)
print("Chat ID is: ")
print(self.chat_id)
# print(messages)
# print(user_message)

# question = user_message

return user_message
1 change: 1 addition & 0 deletions pipelines/first_pipeline/valves.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}

0 comments on commit aa46981

Please sign in to comment.