Skip to content

Commit

Permalink
fix jina module not find bug (infiniflow#1779)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

fix jina module not find bug

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

Co-authored-by: Zhedong Cen <cenzhedong2@126.com>
  • Loading branch information
hangters and aopstudio authored Aug 1, 2024
1 parent e8b9871 commit 4ba1ba9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rag/llm/chat_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import json
import requests
import asyncio
from rag.svr.jina_server import Prompt,Generation

class Base(ABC):
def __init__(self, key, model_name, base_url):
Expand Down Expand Up @@ -413,13 +412,15 @@ def __init__(self, key, model_name):
self.client = Client(port=12345, protocol="grpc", asyncio=True)

def _prepare_prompt(self, system, history, gen_conf):
from rag.svr.jina_server import Prompt,Generation
if system:
history.insert(0, {"role": "system", "content": system})
if "max_tokens" in gen_conf:
gen_conf["max_new_tokens"] = gen_conf.pop("max_tokens")
return Prompt(message=history, gen_conf=gen_conf)

def _stream_response(self, endpoint, prompt):
from rag.svr.jina_server import Prompt,Generation
answer = ""
try:
res = self.client.stream_doc(
Expand Down

0 comments on commit 4ba1ba9

Please sign in to comment.