Skip to content

Commit

Permalink
Add LM Studio Support (#1805)
Browse files Browse the repository at this point in the history
  • Loading branch information
NolanTrem authored Jan 11, 2025
1 parent 924d2a3 commit 84f5273
Show file tree
Hide file tree
Showing 7 changed files with 157 additions and 84 deletions.
2 changes: 1 addition & 1 deletion js/sdk/package-lock.json

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

61 changes: 61 additions & 0 deletions py/core/configs/lm_studio.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[agent]
system_instruction_name = "rag_agent"
tool_names = ["local_search"]

[agent.generation_config]
model = "lm_studio/llama-3.2-3b-instruct"

[completion]
provider = "litellm"
concurrent_request_limit = 1

[completion.generation_config]
model = "lm_studio/llama-3.2-3b-instruct"
temperature = 0.1
top_p = 1
max_tokens_to_sample = 1_024
stream = false
add_generation_kwargs = { }

[embedding]
provider = "litellm"
base_model = "lm_studio/text-embedding-nomic-embed-text-v1.5"
base_dimension = nan
batch_size = 128
add_title_as_prefix = true
concurrent_request_limit = 2

[database]
provider = "postgres"

[database.graph_creation_settings]
graph_entity_description_prompt = "graphrag_entity_description"
entity_types = [] # if empty, all entities are extracted
relation_types = [] # if empty, all relations are extracted
fragment_merge_count = 4 # number of fragments to merge into a single extraction
max_knowledge_relationships = 100
max_description_input_length = 65536
generation_config = { model = "lm_studio/llama-3.2-3b-instruct" } # and other params, model used for relationshipt extraction

[database.graph_enrichment_settings]
community_reports_prompt = "graphrag_community_reports"
max_summary_input_length = 65536
generation_config = { model = "lm_studio/llama-3.2-3b-instruct" } # and other params, model used for node description and graph clustering
leiden_params = {}

[database.graph_search_settings]
generation_config = { model = "lm_studio/llama-3.2-3b-instruct" }


[orchestration]
provider = "simple"


[ingestion]
vision_img_model = "lm_studio/llama3.2-vision"
vision_pdf_model = "lm_studio/llama3.2-vision"
chunks_for_document_summary = 16
document_summary_model = "lm_studio/llama-3.2-3b-instruct"

[ingestion.extra_parsers]
pdf = "zerox"
163 changes: 82 additions & 81 deletions py/poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions py/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "r2r"
readme = "README.md"
version = "3.3.26"
version = "3.3.27"

description = "SciPhi R2R"
authors = ["Owen Colegrove <[email protected]>"]
Expand Down Expand Up @@ -61,7 +61,7 @@ future = { version = "^1.0.0", optional = true }
graspologic = { version = "^3.4.1", optional = true }
gunicorn = { version = "^21.2.0", optional = true }
hatchet-sdk = { version = "^0.38.0", optional = true }
litellm = { version = "^1.52.8", optional = true }
litellm = { version = "^1.57.7", optional = true }
networkx = { version = "^3.3", optional = true }
ollama = { version = "^0.3.1", optional = true }
passlib = { version = "^1.7.4", optional = true }
Expand Down
3 changes: 3 additions & 0 deletions py/r2r/compose.full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,9 @@ services:
# Ollama
- OLLAMA_API_BASE=${OLLAMA_API_BASE:-http://host.docker.internal:11434}

# LM Studio
- LM_STUDIO_API_BASE=${LM_STUDIO_API_BASE:-http://host.docker.internal:1234}

# Huggingface
- HUGGINGFACE_API_BASE=${HUGGINGFACE_API_BASE:-http://host.docker.internal:8080}
- HUGGINGFACE_API_KEY=${HUGGINGFACE_API_KEY}
Expand Down
3 changes: 3 additions & 0 deletions py/r2r/compose.full_with_replicas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,9 @@ services:
# Ollama
- OLLAMA_API_BASE=${OLLAMA_API_BASE:-http://host.docker.internal:11434}

# LM Studio
- LM_STUDIO_API_BASE=${LM_STUDIO_API_BASE:-http://host.docker.internal:1234}

# Huggingface
- HUGGINGFACE_API_BASE=${HUGGINGFACE_API_BASE:-http://host.docker.internal:8080}
- HUGGINGFACE_API_KEY=${HUGGINGFACE_API_KEY}
Expand Down
5 changes: 5 additions & 0 deletions py/r2r/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ services:
# Ollama
- OLLAMA_API_BASE=${OLLAMA_API_BASE:-http://host.docker.internal:11434}


# LM Studio
- LM_STUDIO_API_BASE=${LM_STUDIO_API_BASE:-http://host.docker.internal:1234}

# Huggingface
- HUGGINGFACE_API_BASE=${HUGGINGFACE_API_BASE:-http://host.docker.internal:8080}
- HUGGINGFACE_API_KEY=${HUGGINGFACE_API_KEY}
Expand All @@ -126,6 +130,7 @@ services:
- GITHUB_CLIENT_SECRET=${GITHUB_CLIENT_SECRET}
- GITHUB_REDIRECT_URI=${GITHUB_REDIRECT_URI}


networks:
- r2r-network
healthcheck:
Expand Down

0 comments on commit 84f5273

Please sign in to comment.