From 3fc6b0e0457d58ef8fbed619f4d2e01df228ab69 Mon Sep 17 00:00:00 2001 From: Vikasqblocks <133980679+Vikasqblocks@users.noreply.github.com> Date: Mon, 28 Aug 2023 20:31:19 +0530 Subject: [PATCH] Bugfix MonsterAPI Pydantic version v2/v1 support. Doc Update (#7432) --- .readthedocs.yaml | 24 +++++++++++++----------- llama_index/llms/monsterapi.py | 8 ++++++-- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index fef23130fe..7fded15a41 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -1,17 +1,19 @@ -version: 2 +# Read the Docs configuration file for Sphinx projects +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details -sphinx: - configuration: docs/conf.py +# Required +version: 2 +# Set the OS, Python version and other tools you might need build: - image: testing + os: ubuntu-22.04 + tools: + python: "3.11" -# NOTE: only build default HTML -# formats: all +# Build documentation in the "docs/" directory with Sphinx +sphinx: + configuration: docs/conf.py python: - version: 3.9 - install: - - requirements: docs/requirements.txt - - method: pip - path: . \ No newline at end of file + install: + - requirements: docs/requirements.txt diff --git a/llama_index/llms/monsterapi.py b/llama_index/llms/monsterapi.py index 1062eb823d..8e513bad23 100644 --- a/llama_index/llms/monsterapi.py +++ b/llama_index/llms/monsterapi.py @@ -1,5 +1,9 @@ from typing import Any, Callable, Dict, Optional, Sequence -from pydantic import Field, PrivateAttr + +try: + from pydantic.v1 import Field, PrivateAttr +except ImportError: + from pydantic import Field, PrivateAttr from llama_index.callbacks import CallbackManager @@ -86,7 +90,7 @@ class MonsterLLM(CustomLLM): llm_models_enabled = [i for i, j in MODEL_TYPES.items() if j == "LLM"] - return MonsterClient(str(monster_api_key)), llm_models_enabled + return MonsterClient(monster_api_key), llm_models_enabled @property def metadata(self) -> LLMMetadata: -- GitLab