Skip to content

Commit

Permalink
Bug fixes (#10971)
Browse files Browse the repository at this point in the history
  • Loading branch information
logan-markewich authored Feb 19, 2024
1 parent e100055 commit a607f97
Show file tree
Hide file tree
Showing 14 changed files with 161 additions and 53 deletions.
1 change: 0 additions & 1 deletion docs/BUILD

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion docs/examples/finetuning/embeddings/BUILD

This file was deleted.

1 change: 0 additions & 1 deletion docs/examples/output_parsing/BUILD

This file was deleted.

9 changes: 9 additions & 0 deletions docs/module_guides/models/llms/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,15 @@ maxdepth: 1
/examples/llm/monsterapi.ipynb
```

## MyMagic

```{toctree}
---
maxdepth: 1
---
/examples/llm/mymagic.ipynb
```

## NeutrinoAI

```{toctree}
Expand Down
18 changes: 0 additions & 18 deletions llama-index-core/llama_index/core/graph_stores/registry.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Simple node parser."""

from typing import Any, Callable, List, Optional, Sequence

from llama_index.core.bridge.pydantic import Field
Expand Down Expand Up @@ -115,7 +116,9 @@ def build_window_nodes_from_documents(
# add window to each node
for i, node in enumerate(nodes):
window_nodes = nodes[
max(0, i - self.window_size) : min(i + self.window_size, len(nodes))
max(0, i - self.window_size) : min(
i + self.window_size + 1, len(nodes)
)
]

node.metadata[self.window_metadata_key] = " ".join(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Any, Dict, List, Optional, Sequence

from llama_index.core.bridge.pydantic import Field
from llama_index.core.llms import LLM, ChatMessage, ChatResponse, OpenAI
from llama_index.core.llms import LLM, ChatMessage, ChatResponse
from llama_index.core.postprocessor.types import BaseNodePostprocessor
from llama_index.core.prompts import BasePromptTemplate
from llama_index.core.prompts.default_prompts import RANKGPT_RERANK_PROMPT
Expand All @@ -14,12 +14,18 @@
logger.setLevel(logging.WARNING)


def get_default_llm() -> LLM:
from llama_index.llms.openai import OpenAI

return OpenAI(model="gpt-3.5-turbo-16k")


class RankGPTRerank(BaseNodePostprocessor):
"""RankGPT-based reranker."""

top_n: int = Field(default=5, description="Top N nodes to return from reranking.")
llm: LLM = Field(
default_factory=lambda: OpenAI(model="gpt-3.5-turbo-16k"),
default_factory=get_default_llm,
description="LLM to use for rankGPT",
)
verbose: bool = Field(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
from llama_index.core.base.base_query_engine import BaseQueryEngine
from llama_index.core.base.response.schema import RESPONSE_TYPE
from llama_index.core.callbacks.schema import CBEventType, EventPayload
from llama_index.core.graph_stores.registry import (
GRAPH_STORE_CLASS_TO_GRAPH_STORE_TYPE,
)
from llama_index.core.llms.llm import LLM
from llama_index.core.prompts.base import (
BasePromptTemplate,
Expand Down Expand Up @@ -89,11 +86,6 @@ def __init__(

self._llm = llm or llm_from_settings_or_context(Settings, service_context)

# Get Graph Store Type
self._graph_store_type = GRAPH_STORE_CLASS_TO_GRAPH_STORE_TYPE[
self.graph_store.__class__
]

# Get Graph schema
self._graph_schema = self.graph_store.get_schema(refresh=refresh_schema)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ def get_response_synthesizer(
)
elif response_mode == ResponseMode.NO_TEXT:
return NoText(
llm=llm,
streaming=streaming,
callback_manager=callback_manager,
prompt_helper=prompt_helper,
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ description = "llama-index embeddings azure openai integration"
license = "MIT"
name = "llama-index-embeddings-azure-openai"
readme = "README.md"
version = "0.1.2"
version = "0.1.3"

[tool.poetry.dependencies]
python = ">=3.8.1,<3.12"
llama-index-core = "^0.10.1"
llama-index-llms-azure-openai = "^0.1.1"
llama-index-llms-openai = "^0.1.1"
llama-index-embeddings-openai = "^0.1.3"

[tool.poetry.group.dev.dependencies]
ipython = "8.10.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,12 @@ def get_engine(
mode: str,
model: str,
mode_model_dict: Dict[Tuple[OpenAIEmbeddingMode, str], OpenAIEmbeddingModeModel],
) -> OpenAIEmbeddingModeModel:
) -> str:
"""Get engine."""
key = (OpenAIEmbeddingMode(mode), OpenAIEmbeddingModelType(model))
if key not in mode_model_dict:
raise ValueError(f"Invalid mode, model combination: {key}")
return mode_model_dict[key]
return mode_model_dict[key].value


class OpenAIEmbedding(BaseEmbedding):
Expand Down Expand Up @@ -275,8 +275,8 @@ class OpenAIEmbedding(BaseEmbedding):
),
)

_query_engine: OpenAIEmbeddingModeModel = PrivateAttr()
_text_engine: OpenAIEmbeddingModeModel = PrivateAttr()
_query_engine: str = PrivateAttr()
_text_engine: str = PrivateAttr()
_client: Optional[OpenAI] = PrivateAttr()
_aclient: Optional[AsyncOpenAI] = PrivateAttr()
_http_client: Optional[httpx.Client] = PrivateAttr()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ description = "llama-index embeddings openai integration"
license = "MIT"
name = "llama-index-embeddings-openai"
readme = "README.md"
version = "0.1.2"
version = "0.1.3"

[tool.poetry.dependencies]
python = ">=3.8.1,<3.12"
Expand Down

0 comments on commit a607f97

Please sign in to comment.