Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# PR #1 Ali 11/18/2025
## Features
- added groq provider
## Added Files
- CHANGELOG.md
## Fixes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There's a trailing space after Fixes. For consistency with the other headers in this file, it should be removed.

Suggested change
## Fixes
## Fixes

changed the submit button from ctrl+j to enter
10 changes: 5 additions & 5 deletions codebase_rag/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,15 +490,15 @@ def get_multiline_input(prompt_text: str = "Ask a question") -> str:
"""Get multiline input from user with Ctrl+J to submit."""
bindings = KeyBindings()

@bindings.add("c-j")
@bindings.add("enter")
def submit(event: Any) -> None:
"""Submit the current input."""
event.app.exit(result=event.app.current_buffer.text)

@bindings.add("enter")
def new_line(event: Any) -> None:
"""Insert a new line instead of submitting."""
event.current_buffer.insert_text("\n")
# @bindings.add("enter")
# def new_line(event: Any) -> None:
# """Insert a new line instead of submitting."""
# event.current_buffer.insert_text("\n")
Comment on lines +493 to +501
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

By changing the submit key to Enter and commenting out the new_line function, you've disabled the ability to input multiple lines in a function named get_multiline_input. This is a significant regression in functionality.

I suggest swapping the key bindings, so that Enter submits and Ctrl+J creates a new line. This would align with the change description and preserve multiline functionality.

Additionally, the function's docstring on line 490 and the user prompt on line 514 are now outdated and should be updated to reflect these new key bindings. For example:

  • Docstring: Get multiline input from user with Enter to submit and Ctrl+J for a new line.
  • Prompt: (Press Enter to submit, Ctrl+J for new line)
Suggested change
@bindings.add("enter")
def submit(event: Any) -> None:
"""Submit the current input."""
event.app.exit(result=event.app.current_buffer.text)
@bindings.add("enter")
def new_line(event: Any) -> None:
"""Insert a new line instead of submitting."""
event.current_buffer.insert_text("\n")
# @bindings.add("enter")
# def new_line(event: Any) -> None:
# """Insert a new line instead of submitting."""
# event.current_buffer.insert_text("\n")
@bindings.add("enter")
def submit(event: Any) -> None:
"""Submit the current input."""
event.app.exit(result=event.app.current_buffer.text)
@bindings.add("c-j")
def new_line(event: Any) -> None:
"""Insert a new line instead of submitting."""
event.current_buffer.insert_text("\n")


@bindings.add("c-c")
def keyboard_interrupt(event: Any) -> None:
Expand Down
25 changes: 24 additions & 1 deletion codebase_rag/providers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from pydantic_ai.providers.google_gla import GoogleGLAProvider
from pydantic_ai.providers.google_vertex import GoogleVertexProvider, VertexAiRegion
from pydantic_ai.providers.openai import OpenAIProvider as PydanticOpenAIProvider
from pydantic_ai.models.groq import GroqModel
from pydantic_ai.providers.groq import GroqProvider as PydanticGroqProvider


class ModelProvider(ABC):
Expand Down Expand Up @@ -125,6 +127,26 @@ def create_model(self, model_id: str, **kwargs: Any) -> OpenAIResponsesModel:
return OpenAIResponsesModel(model_id, provider=provider, **kwargs)


class GroqProvider(ModelProvider):
"""Groq provider – uses Groq’s ultra‑fast inference API."""
def __init__(self, api_key: str | None = None, **kwargs: Any) -> None:
super().__init__(**kwargs)
self.api_key = api_key

@property
def provider_name(self) -> str:
return "groq"

def validate_config(self) -> None:
if not self.api_key:
raise ValueError("Groq provider requires api_key.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This error message is a bit generic. For a better user experience, it would be helpful to guide the user on how to provide the API key, similar to how other providers in this file do (e.g., by suggesting which environment variable to set).

Suggested change
raise ValueError("Groq provider requires api_key.")
raise ValueError("Groq provider requires api_key. Set ORCHESTRATOR_API_KEY or CYPHER_API_KEY in .env file.")


def create_model(self, model_id: str, **kwargs: Any) -> GroqModel:
self.validate_config()
provider = PydanticGroqProvider(api_key=self.api_key)
return GroqModel(model_id, provider=provider, **kwargs)


class OllamaProvider(ModelProvider):
"""Ollama local provider."""

Expand Down Expand Up @@ -163,6 +185,7 @@ def create_model(self, model_id: str, **kwargs: Any) -> OpenAIModel:
PROVIDER_REGISTRY: dict[str, type[ModelProvider]] = {
"google": GoogleProvider,
"openai": OpenAIProvider,
"groq": GroqProvider,
"ollama": OllamaProvider,
}

Expand Down Expand Up @@ -198,4 +221,4 @@ def check_ollama_running(endpoint: str = "http://localhost:11434") -> bool:
response = client.get(health_url)
return bool(response.status_code == 200)
except (httpx.RequestError, httpx.TimeoutException):
return False
return False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The file is missing a newline at the end. It's a common convention (and recommended by PEP 8) to end files with a single newline character. This can prevent issues with file concatenation and some version control systems.