# Full Example: https://github.com/geekan/MetaGPT/blob/main/config/config2.example.yaml # Reflected Code: https://github.com/geekan/MetaGPT/blob/main/metagpt/config2.py # Config Docs: https://docs.deepwisdom.ai/main/en/guide/get_started/configuration.html llm: api_type:"open_llm"# or azure / ollama / groq etc. model:"glm4"# or gpt-3.5-turbo base_url:"http://127.0.0.1:7860/v1"# or forward url / other llm url # max_token: 6000 # api_key: "empty"
# RAG Embedding. # For backward compatibility, if the embedding is not set and the llm's api_type is either openai or azure, the llm's config will be used. embedding: api_type:"ollama"# openai / azure / gemini / ollama etc. Check EmbeddingType for more options. base_url:"http://127.0.0.1:6006" # api_key: "" model:"bge-m3:567m" dimensions:"1024"# output dimension of embedding model
RAG示例项目
接下来,运行官方的RAG示例项目:rag_pipeline.py,且注释掉es的代码:
asyncdefmain(): """RAG pipeline.
Note: 1. If `use_llm_ranker` is True, then it will use LLM Reranker to get better result, but it is not always guaranteed that the output will be parseable for reranking, prefer `gpt-4-turbo`, otherwise might encounter `IndexError: list index out of range` or `ValueError: invalid literal for int() with base 10`. """
# 解决 ValueError: Calculated available context size -12792 was not non-negative. 报错的问题 Settings._prompt_helper = PromptHelper(context_window=6000) e = RAGExample(use_llm_ranker=False)
官方文档也提过可能会有ValueError: Calculated available context size -12792 was not non-negative的报错,我也遇到了,本质上是集成的llama_index抛出来的,有两种方式一个是官方推荐的max_token,我用的另一个:Settings._prompt_helper = PromptHelper(context_window=6000)。