Skip to content

Commit

Permalink
Merge pull request #81 from Renumics/fix/local-rag-example-provider-name
Browse files Browse the repository at this point in the history
change provider name and improve chat format
  • Loading branch information
SYoy authored Mar 5, 2025
2 parents 5ac75b4 + d729312 commit 9b4abc7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
9 changes: 7 additions & 2 deletions examples/advanced-local-rag/backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,13 @@ def generate_stream(messages: List[Message], context: str = "") -> TextIteratorS
input_text = tokenizer.apply_chat_template(formatted_messages, tokenize=False)
inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)

# 2) Create the streamer (handles partial text as tokens arrive)
streamer = TextIteratorStreamer(tokenizer, skip_prompt=True)
# 2) Create the streamer with skip_prompt and skip_special_tokens
streamer = TextIteratorStreamer(
tokenizer,
skip_prompt=True,
skip_special_tokens=True,
timeout=10.0
)

# 3) Define a thread function that does generation
def run_generation():
Expand Down
4 changes: 3 additions & 1 deletion examples/advanced-local-rag/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions examples/advanced-local-rag/frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useCallback, useMemo } from 'react';
import {
ChatWindow,
RAGProvider,
LexioProvider,
SourcesDisplay,
ContentDisplay,
AdvancedQueryField,
Expand Down Expand Up @@ -135,7 +135,7 @@ function App() {
// 4) Provide the SSE connector and the REST content source to the RAGProvider
return (
<div className="app-container">
<RAGProvider
<LexioProvider
onAction={onAction}
config={{
timeouts: {
Expand Down Expand Up @@ -207,7 +207,7 @@ function App() {
</div>
{/* Handle any encountered errors */}
<ErrorDisplay />
</RAGProvider>
</LexioProvider>
</div>
);
}
Expand Down
8 changes: 4 additions & 4 deletions lexio/lib/components/ChatWindow/AssistantMarkdownContent.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@

/* Lists */
.assistant-markdown-content ul {
white-space: nowrap;
white-space: normal;
margin-top: 6px;
margin-bottom: 6px;
list-style: disc inside;
list-style: disc outside;
padding-left: 10px;
}

.assistant-markdown-content ol {
white-space: nowrap;
white-space: normal;
margin-top: 6px;
margin-bottom: 6px;
list-style: decimal inside;
list-style: decimal outside;
padding-left: 10px;
}

Expand Down

0 comments on commit 9b4abc7

Please sign in to comment.