refactor: update model provider#45
Merged
Merged
Conversation
Member
Author
|
the pr fixes following issue: |
MelvinKl
reviewed
Jul 8, 2025
…for testing; remove unused fake LLM provider
…d structure and consistency
…te for tracing integration
…rocess in LangfuseManager
…tations to use ChatPromptTemplate
…ger and related files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors the handling of language model providers and enhances the robustness of AI-generated outputs across multiple files. Key changes include replacing the
llm_providerfunction with the newchat_model_provider, improving error handling for AI responses, and adding support for output parsers in specific chains.Refactoring and Provider Updates:
libs/admin-api-lib/src/admin_api_lib/dependency_container.py: Replacedllm_providerwithchat_model_providerforollamaandstackitmodels, and updated the Singleton initialization to use provider-specific strings ("ollama" and "openai"). [1] [2]libs/rag-core-api/src/rag_core_api/dependency_container.py: Similar updates to replacellm_providerwithchat_model_providerand update Singleton initialization forollama,stackit, andfakemodels. Also fixed a key mapping issue by changingapi_keytoopenai_api_key. [1] [2] [3]AI Output Handling:
libs/admin-api-lib/src/admin_api_lib/impl/summarizer/langchain_summarizer.py: Enhanced error handling to ensure AIMessage content is extracted properly and converted to a string if necessary.libs/rag-core-api/src/rag_core_api/impl/graph/chat_graph.py: Added logic to validate and convert AI-generated responses (rephrased_questionandanswer_text) into strings.Output Parser Integration:
libs/rag-core-api/src/rag_core_api/impl/answer_generation_chains/answer_generation_chain.py: IntegratedStrOutputParserinto the chain creation process for better output parsing. [1] [2]libs/rag-core-api/src/rag_core_api/impl/answer_generation_chains/rephrasing_chain.py: AddedStrOutputParserto the chain creation for consistent output handling. [1] [2]Dependency and Test Updates:
libs/rag-core-lib/pyproject.toml: Updatedlangchain-coreto version0.3.68and addedlangchain-openaias a dependency. Adjusted per-file ignores for linting rules. [1] [2]libs/rag-core-lib/src/rag_core_lib/impl/llms/llm_factory.py: Replacedllm_providerwithchat_model_provider, introduced_PROVIDER_KEY_MAPfor unified key mapping, and refactored the logic to initialize chat models usinginit_chat_model.libs/rag-core-lib/tests/chat_model_provider_test.py: Added a new test script to validate the functionality ofchat_model_providerwith the updated approach.libs/rag-core-lib/tests/dummy6_test.py: Removed the dummy test file as part of cleanup.