nsbradford / SemanticSearch

Minimal RAG (Retrieval Augmented Generation) website with Pinecone, FastAPI, NextJS, MongoDB
https://semantic-search-six.vercel.app
9 stars 3 forks source link

[BitBuilder] Add session ID to llm request metadata #42

Closed ellipsis-dev[bot] closed 1 year ago

ellipsis-dev[bot] commented 1 year ago

Summary:

Issue: https://github.com/nsbradford/SemanticSearch/issues/41 Plan feedback: Approved by @nsbradford

Implementation:

  1. Add sessionId to LLMChatCompletionRequest interface
    • In the /ui/shared/api.ts file, add a new field sessionId to the LLMChatCompletionRequest interface. The sessionId should be of type string.
  2. Pass sessionId to sendLLMRequest
    • In the /ui/pages/index.tsx file, modify the sendLLMRequest function call inside the handleNewUserPrompt function to pass the sessionId along with the existing data.
  3. Add sessionId to LLMChatCompletionRequest model
    • In the /backend/models.py file, add a new field sessionId to the LLMChatCompletionRequest class. The sessionId should be of type str.
  4. Modify llm endpoint to accept sessionId
    • In the /backend/main.py file, modify the llm endpoint to accept sessionId as part of the request body. Update the llm_get function call inside the llm endpoint to pass the sessionId along with the existing data.
  5. Modify llm_get function to accept sessionId
    • In the /backend/llm.py file, modify the llm_get function to accept sessionId as an argument. Update the metadata object inside the acompletion function call to include the sessionId.
Report: Step Result Details
1
Add sessionId to LLMChatCompletionRequest interfaceAdded sessionId to LLMChatCompletionRequest interface in /ui/shared/api.ts
2
Pass sessionId to sendLLMRequestModified the sendLLMRequest function call inside the handleNewUserPrompt function in /ui/pages/index.tsx to pass the sessionId along with the existing data.
3
Add sessionId to LLMChatCompletionRequest modelAdded sessionId to LLMChatCompletionRequest class in /backend/models.py
4
Modify llm endpoint to accept sessionIdModified the llm endpoint in /backend/main.py to accept sessionId as part of the request body and updated the llm_get function call inside the llm endpoint to pass the sessionId along with the existing data. Also modified the llm_get function in /backend/llm.py to accept sessionId as an argument and updated the metadata object inside the acompletion function call to include the sessionId.
5
Modify llm_get function to accept sessionIdModified the llm_get function in /backend/llm.py to accept sessionId as an argument and updated the metadata object inside the acompletion function call to include the sessionId.

Something look wrong?: If this Pull Request doesn't contain the expected changes, add more information to #41. Then, add the bitbuilder:create label to try again. For more information, check the documentation.

Generated with :heart: by www.bitbuilder.ai

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
semantic-search-mini ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 26, 2023 4:02pm
coderabbitai[bot] commented 1 year ago

[!IMPORTANT]

Auto Review Skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.


Tips ### Chat with CodeRabbit Bot (`@coderabbitai`) - If you reply to a *review comment* from CodeRabbit, the bot will automatically respond. - To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment - Note: Review comments are made on code diffs or files, not on the PR overview. - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai help` to get help. Note: For conversation with the bot, please use the review comments on code diffs or files. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - The JSON schema for the configuration file is available [here](https://coderabbit.ai/integrations/coderabbit-overrides.json). - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.json`
sweep-ai[bot] commented 1 year ago

Apply Sweep Rules to your PR?

ellipsis-dev[bot] commented 1 year ago

Rule Checks: :warning: Possible violations detected :warning:

Found 1 warnings.

:warning: Warnings :warning:

  1. Error Handling Must Be Implemented for services
    • Description: Proper error handling should be implemented in the code to ensure that the application can handle and recover from unexpected situations gracefully.
    • Error: While the code does implement some error handling, it is not consistent across all services. For example, the 'sendLLMRequest' function in '/ui/shared/api.ts' does not have any error handling implemented. This could lead to unhandled exceptions if the request fails. It is recommended to add error handling to all services to ensure the application can recover gracefully from unexpected situations.
    • Files:
      • /ui/shared/api.ts

Passing checks

There are 7 passing checks. 1. Code should be DRY (Dont Repeat Yourself) 1. There should no secrets or credentials in the code 1. Extremely Complicated Code Needs Comments 1. Use Descriptive Variable and Constant Names 1. Dont log sensative data 1. Follow the Single Responsibility Principle 1. Function and Method Naming Should Follow Consistent Patterns

Something look wrong? If this Code Review doesn't contain the expected results, you may need to update your rules. For more information, check the documentation.

Generated with :heart: by www.bitbuilder.ai.