-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update .gitignore to include pipeline files
- Loading branch information
Showing
3 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,10 @@ __pycache__ | |
|
||
|
||
pipelines/* | ||
!pipelines/*.* | ||
!pipelines/.gitignore | ||
.DS_Store | ||
|
||
.venv | ||
venv/ | ||
venv/ | ||
__pycache__ |
This file contains 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
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 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |