Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Streaming for replies #449

Merged
merged 11 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 70 additions & 50 deletions App_Function_Libraries/Gradio_UI/Explain_summarize_tab.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions App_Function_Libraries/Gradio_UI/Re_summarize_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def resummarize_content(selected_item, item_mapping, content, api_name, api_key=

# Use default prompt if not provided
if not summarization_prompt:
summarization_prompt = config.get('Prompts', 'default_summary_prompt', fallback="""<s>You are a bulleted notes specialist. [INST]```When creating comprehensive bulleted notes, you should follow these guidelines: Use multiple headings based on the referenced topics, not categories like quotes or terms. Headings should be surrounded by bold formatting and not be listed as bullet points themselves. Leave no space between headings and their corresponding list items underneath. Important terms within the content should be emphasized by setting them in bold font. Any text that ends with a colon should also be bolded. Before submitting your response, review the instructions, and make any corrections necessary to adhered to the specified format. Do not reference these instructions within the notes.``` \nBased on the content between backticks create comprehensive bulleted notes.[/INST]
summarization_prompt = config.get('Prompts', 'default_summary_prompt', fallback="""<s>You are a bulleted notes specialist. ```When creating comprehensive bulleted notes, you should follow these guidelines: Use multiple headings based on the referenced topics, not categories like quotes or terms. Headings should be surrounded by bold formatting and not be listed as bullet points themselves. Leave no space between headings and their corresponding list items underneath. Important terms within the content should be emphasized by setting them in bold font. Any text that ends with a colon should also be bolded. Before submitting your response, review the instructions, and make any corrections necessary to adhered to the specified format. Do not reference these instructions within the notes.``` \nBased on the content between backticks create comprehensive bulleted notes.
**Bulleted Note Creation Guidelines**

**Headings**:
Expand All @@ -284,7 +284,7 @@ def resummarize_content(selected_item, item_mapping, content, api_name, api_key=

**Review**:
- Ensure adherence to specified format
- Do not reference these instructions in your response.</s>[INST] {{ .Prompt }} [/INST]""")
- Do not reference these instructions in your response.</s>[INST] {{ .Prompt }}""")

# Summarization logic
summaries = []
Expand Down
868 changes: 581 additions & 287 deletions App_Function_Libraries/LLM_API_Calls.py

Large diffs are not rendered by default.

827 changes: 586 additions & 241 deletions App_Function_Libraries/LLM_API_Calls_Local.py

Large diffs are not rendered by default.

811 changes: 579 additions & 232 deletions App_Function_Libraries/Summarization/Local_Summarization_Lib.py

Large diffs are not rendered by default.

902 changes: 629 additions & 273 deletions App_Function_Libraries/Summarization/Summarization_General_Lib.py

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions App_Function_Libraries/Utils/Utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ def load_and_log_configs():

# Local-Models
kobold_api_ip = config.get('Local-API', 'kobold_api_IP', fallback='http://127.0.0.1:5000/api/v1/generate')
kobold_openai_api_IP = config.get('Local-API', 'kobold_openai_api_IP', fallback='http://127.0.0.1:5001/v1/chat/completions')
kobold_api_key = config.get('Local-API', 'kobold_api_key', fallback='')

llama_api_IP = config.get('Local-API', 'llama_api_IP', fallback='http://127.0.0.1:8080/v1/chat/completions')
Expand Down Expand Up @@ -335,6 +336,7 @@ def load_and_log_configs():
},
'local_api_ip': {
'kobold': kobold_api_ip,
'kobold_openai': kobold_openai_api_IP,
'llama': llama_api_IP,
'ooba': ooba_api_IP,
'tabby': tabby_api_IP,
Expand Down
24 changes: 16 additions & 8 deletions Config_Files/Backup_Config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,23 @@ groq_api_key = <groq_api_key>
groq_model = llama3-70b-8192
openai_api_key = <openai_api_key>
openai_model = gpt-4o
huggingface_api_key = <huggingface_api_token>
huggingface_model = CohereForAI/c4ai-command-r-plus
huggingface_api_key = <huggingface_api_key>
huggingface_model = meta-llama/Llama-3.1-70B-Instruct
openrouter_api_key = <openrouter_api_key>
openrouter_model = mistralai/mistral-7b-instruct:free
deepseek_api_key = <deepseek-api-key>
deepseek_api_key = <deepseek_api_key>
deepseek_model = deepseek-chat
mistral_model = mistral-large-latest
mistral_api_key = <mistral_api_key>
google_api_key =
mistral_model = mistral-large-latest
google_api_key = <google_api_key>
google_model = gemini-1.5-pro
custom_openai_api_key = <key_here>
custom_openai_api_ip = <api_ip_here>
default_api = openai

[Local-API]
kobold_api_IP = http://127.0.0.1:5001/api/v1/generate
kobold_openai_api_IP = http://127.0.0.1:5001/v1/chat/completions
kobold_api_key =
llama_api_IP = http://127.0.0.1:8080/completion
llama_api_key =
Expand All @@ -37,6 +38,7 @@ ollama_api_key =
ollama_model = llama3
aphrodite_api_IP = http://127.0.0.1:8080/completion
aphrodite_api_key =
max_tokens = 4096

[Processing]
processing_choice = cuda
Expand All @@ -47,11 +49,19 @@ words_per_second = 3
save_character_chats = False
save_rag_chats = False
local_api_timeout = 90
local_api_retries = 3
local_api_retry_delay = 5
streaming = True
temperature = 0.7
top_p = 0.9
min_p = 0.05
# https://artefact2.github.io/llm-sampling/

[Auto-Save]
save_character_chats = False
save_rag_chats = False


[Prompts]
prompt_sample = "What is the meaning of life?"
video_summarize_prompt = "Above is the transcript of a video. Please read through the transcript carefully. Identify the main topics that are discussed over the course of the transcript. Then, summarize the key points about each main topic in bullet points. The bullet points should cover the key information conveyed about each topic in the video, but should be much shorter than the full transcript. Please output your bullet point summary inside <bulletpoints> tags. Do not repeat yourself while writing the summary."
Expand Down Expand Up @@ -144,6 +154,4 @@ backup_count = 5
# gemini-1.5-flash
# gemini-1.5-flash-8b
# aqa
# text-embedding-004


# text-embedding-004
42 changes: 30 additions & 12 deletions Config_Files/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,23 @@ groq_api_key = <groq_api_key>
groq_model = llama3-70b-8192
openai_api_key = <openai_api_key>
openai_model = gpt-4o
huggingface_api_key = <huggingface_api_token>
huggingface_model = CohereForAI/c4ai-command-r-plus
huggingface_api_key = <huggingface_api_key>
huggingface_model = meta-llama/Llama-3.1-70B-Instruct
openrouter_api_key = <openrouter_api_key>
openrouter_model = mistralai/mistral-7b-instruct:free
deepseek_api_key = <deepseek-api-key>
deepseek_api_key = <deepseek_api_key>
deepseek_model = deepseek-chat
mistral_model = mistral-large-latest
mistral_api_key = <mistral_api_key>
google_api_key =
mistral_model = mistral-large-latest
google_api_key = <google_api_key>
google_model = gemini-1.5-pro
custom_openai_api_key = <key_here>
custom_openai_api_ip = <api_ip_here>
default_api = openai

[Local-API]
kobold_api_IP = http://127.0.0.1:5001/api/v1/generate
kobold_openai_api_IP = http://127.0.0.1:5001/v1/chat/completions
kobold_api_key =
llama_api_IP = http://127.0.0.1:8080/completion
llama_api_key =
Expand Down Expand Up @@ -52,6 +53,7 @@ local_api_timeout = 90
save_character_chats = False
save_rag_chats = False


[Prompts]
prompt_sample = "What is the meaning of life?"
video_summarize_prompt = "Above is the transcript of a video. Please read through the transcript carefully. Identify the main topics that are discussed over the course of the transcript. Then, summarize the key points about each main topic in bullet points. The bullet points should cover the key information conveyed about each topic in the video, but should be much shorter than the full transcript. Please output your bullet point summary inside <bulletpoints> tags. Do not repeat yourself while writing the summary."
Expand Down Expand Up @@ -103,13 +105,29 @@ backup_count = 5

#[Comments]
#OpenAI Models:
# f
# gpt-4o
# gpt-4o-2024-08-06
# gpt-4o-mini
# o1-preview
# o1-mini
# text-embedding-3-large
# text-embedding-3-small
#
#Anthropic Models:
# f
# claude-3-5-sonnet-20241022
# claude-3-5-sonnet-20240620
# claude-3-5-haiku-20241022
# claude-3-opus-20240229
#
#Cohere Models:
# f
# command-r-plus-08-2024
# command-r-plus-04-2024
# command-r-08-2024
# command-r-03-2024
#
#DeepSeek Models:
# f
# deepseek-chat
#
#Groq Models:
# f
#Mistral Models:
Expand All @@ -123,9 +141,9 @@ backup_count = 5
# open-codestral-mamba
# Google's Models (11/15/2024): https://ai.google.dev/gemini-api/docs/models/gemini
# gemini-1.5-pro
# gemini-1.5-pro-2
# LearnLM
# gemini-1.5-flash
# gemini-1.5-flash-8b
# aqa
# text-embedding-004


# text-embedding-004
18 changes: 18 additions & 0 deletions Docs/Bitnet_and_Mamba_Papers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Bitnet and MAMBA Papers



### Bitnet
- Unsorted
- https://arxiv.org/abs/2411.11843



### Mamba
- Unsorted
- f
- f
- f



1 change: 1 addition & 0 deletions Docs/Code_Documentation/Database.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

--------------------
### SQLite
https://mrsuh.com/articles/2024/sqlite-index-visualization-structure/
- **101**
* https://www.sqlite.org/draft/about.html
- **Concurrency**
Expand Down
45 changes: 45 additions & 0 deletions Docs/Design/DB_Design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# DB Design

## Table of Contents
- [General DB](#general-db)
- [SQLite](#sqlite)
- [SQLite DB Design](#sqlite-db-design)
- [Interesting/Relevant Later](#interesting-relevant-later)

https://kerkour.com/sqlite-for-servers
https://wafris.org/blog/rearchitecting-for-sqlite
General DB:
https://en.wikipedia.org/wiki/Database_normalization
https://www.kimballgroup.com/data-warehouse-business-intelligence-resources/kimball-techniques/dimensional-modeling-techniques/

Gradio:
https://www.gradio.app/guides/connecting-to-a-database
https://www.gradio.app/docs/gradio/dataset

SQLite:
https://www.sqlite.org/queryplanner.html
https://www.sqlite.org/optoverview.html
https://www.sqlite.org/queryplanner-ng.html
https://docs.python.org/3/library/sqlite3.html

SQLite Vector Search:
https://github.com/asg017/sqlite-vec
https://alexgarcia.xyz/blog/2024/building-new-vector-search-sqlite/index.html
https://news.ycombinator.com/item?id=40243168
[test-tokenizer-random.py](..%2F..%2F..%2FGithub%2Fllama.cpp%2Ftests%2Ftest-tokenizer-random.py)
SQLite DB Design:
https://stackoverflow.com/questions/66293837/smart-way-to-structure-my-sqlite-database?rq=3
https://stackoverflow.com/questions/7235435/sqlite-structure-advice?rq=3
https://stackoverflow.com/questions/19368506/very-basic-sqlite-table-design?rq=3
https://stackoverflow.com/questions/7665735/how-do-i-organize-such-database-in-sqlite?rq=3
https://stackoverflow.com/questions/29055263/sql-database-layout-design?rq=3

Seems like it might be interesting/relevant later:
https://docs.llamaindex.ai/en/stable/examples/index_structs/struct_indices/SQLIndexDemo/


https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
https://www.youtube.com/watch?v=r09tJfON6kE


error handling, vacuuming, zipping transcriptions above X size, and external storage for documents and said zipped transcriptions
2 changes: 1 addition & 1 deletion Docs/Design/Ideas.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

https://wafris.org/blog/rearchitecting-for-sqlite


Multi-modal support
Collaborative features: Consider adding features that allow multiple users to collaborate on content analysis, annotation, or editing. This could include shared workspaces or real-time collaborative editing.
Expand Down
36 changes: 36 additions & 0 deletions Docs/Handy_Dandy_Papers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Handy Dandy Papers


### Context
https://arxiv.org/pdf/2304.12102
https://arxiv.org/html/2405.20234v2#S3

### Reasoning
- https://huggingface.co/papers/2411.15862

### Test-Time Compute
- https://github.com/GAIR-NLP/O1-Journey


### Personalization
https://arxiv.org/abs/2411.16034


### RAG
https://arxiv.org/html/2407.21059v1

### Sampling
https://arxiv.org/abs/2411.09661


### Storytelling
https://dreamrunner-story2video.github.io/


### Structured Generation
https://arxiv.org/abs/2411.15100

### Test-Time related
https://mathcritique.github.io/


Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ Finetuning:
- https://mattyyeung.github.io/deterministic-quoting#7-conclusion-is-this-really-ready-for-healthcare



Anthropic:
```
Draft a press release for our new cybersecurity product, AcmeSecurity Pro, using only information from these product briefs and market reports.
<documents>
{{DOCUMENTS}}
</documents>

After drafting, review each claim in your press release. For each claim, find a direct quote from the documents that supports it. If you can’t find a supporting quote for a claim, remove that claim from the press release and mark where it was removed with empty [] brackets.
```

Attributions
https://github.com/aws-samples/llm-based-advanced-summarization/blob/main/detect_attribution.ipynb

Expand Down Expand Up @@ -75,12 +86,17 @@ Research
https://www.lycee.ai/blog/rag-ragallucinations-and-how-to-fight-them
https://arxiv.org/abs/2407.16557
https://arxiv.org/abs/2407.16604
https://arxiv.org/pdf/2309.11495
https://deepmind.google/research/publications/85420/
https://thetechoasis.beehiiv.com/p/eliminating-hallucinations-robots-imitate-us
https://arxiv.org/abs/2407.19825
https://arxiv.org/abs/2411.14257
https://arxiv.org/pdf/2406.02543
https://arxiv.org/abs/2406.10279
https://arxiv.org/abs/2402.17811
https://arxiv.org/pdf/2409.18475
https://llm-editing.github.io/
https://arxiv.org/abs/2411.14257
https://arxiv.org/pdf/2407.03651
https://cleanlab.ai/blog/trustworthy-language-model/
https://arxiv.org/abs/2408.07852
Expand Down
Loading