-
Notifications
You must be signed in to change notification settings - Fork 5
refactor: update model provider #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
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
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_provider
function 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_provider
withchat_model_provider
forollama
andstackit
models, 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_provider
withchat_model_provider
and update Singleton initialization forollama
,stackit
, andfake
models. Also fixed a key mapping issue by changingapi_key
toopenai_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_question
andanswer_text
) into strings.Output Parser Integration:
libs/rag-core-api/src/rag_core_api/impl/answer_generation_chains/answer_generation_chain.py
: IntegratedStrOutputParser
into 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
: AddedStrOutputParser
to the chain creation for consistent output handling. [1] [2]Dependency and Test Updates:
libs/rag-core-lib/pyproject.toml
: Updatedlangchain-core
to version0.3.68
and addedlangchain-openai
as 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_provider
withchat_model_provider
, introduced_PROVIDER_KEY_MAP
for 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_provider
with the updated approach.libs/rag-core-lib/tests/dummy6_test.py
: Removed the dummy test file as part of cleanup.