()
| 4 | |
| 5 | |
| 6 | def get_chat_engine(): |
| 7 | system_prompt = os.getenv("SYSTEM_PROMPT") |
| 8 | top_k = os.getenv("TOP_K", 3) |
| 9 | |
| 10 | index = get_index() |
| 11 | if index is None: |
| 12 | raise HTTPException( |
| 13 | status_code=500, |
| 14 | detail=str( |
| 15 | "StorageContext is empty - call 'poetry run generate' to generate the storage first" |
| 16 | ), |
| 17 | ) |
| 18 | |
| 19 | return index.as_chat_engine( |
| 20 | similarity_top_k=int(top_k), |
| 21 | system_prompt=system_prompt, |
| 22 | chat_mode="condense_plus_context", |
| 23 | ) |
nothing calls this directly
no test coverage detected