Find answers from the community

Updated 3 months ago

Langchain

I am trying the Raptor pack with custom LLM and Embedding model import using langchain. and getting this error . Any ideas? File ~/Documents/ai/.venv/lib/python3.10/site-packages/llama_index/core/indices/prompt_helper.py:117, in PromptHelper.from_llm_metadata(cls, llm_metadata, chunk_overlap_ratio, chunk_size_limit, tokenizer, separator)
103 @classmethod
104 def from_llm_metadata(
105 cls,
(...)
110 separator: str = " ",
111 ) -> "PromptHelper":
112 """Create from llm predictor.
113
114 This will autofill values like context_window and num_output.
115
116 """
--> 117 context_window = llm_metadata.context_window
119 if llm_metadata.num_output == -1:
120 num_output = DEFAULT_NUM_OUTPUTS

AttributeError: 'NoneType' object has no attribute 'context_window'
L
B
8 comments
Need to wrap the langchain llm with the langchain wrapper
i am using this ! pip install llama-index-llms-langchain
! pip install llama-index-embeddings-langchain
from llms.oci_llm import llm as oci_genai
from llms.oci_embedding import oci_embeddings
llm = oci_genai()
embedding = oci_embeddings()
from llama_index.core import Settings
Settings.llm = oci_genai()
Settings.embed_model = oci_embeddings()
I am trying to use the LLM and Embedding from Oracle Cloud to build a demo. Is there a native way to import the LLM with llamaindex? Or i need to use langchain?
I don't think we have orcale cloud integrations, so yea, would need langchain

Plain Text
from llama_index.llms.langchain import LangChainLLM
from llama_index.embeddings.langchain import LangchainEmbedding

llm = LangChainLLM(<lc_llm>)
embed_model = LangchainEmbedding(<lc_embedding>)
That worked! Thank You . I appreciate your help.
Add a reply
Sign up and join the conversation on Discord