diff --git a/.github/workflows/deploy-docs-simple.yml b/.github/workflows/deploy-docs-simple.yml deleted file mode 100644 index 6bc8f01..0000000 --- a/.github/workflows/deploy-docs-simple.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Deploy Documentation (Simple) - -on: - push: - branches: [main, dev] - paths: - - 'docs/**' - - 'mkdocs.yml' - workflow_dispatch: - -permissions: - contents: write - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - - name: Install dependencies - run: | - pip install mkdocs mkdocs-material mkdocs-mermaid2-plugin mkdocs-git-revision-date-localized-plugin - - - name: Deploy to GitHub Pages - run: | - git config --global user.name "github-actions[bot]" - git config --global user.email "github-actions[bot]@users.noreply.github.com" - mkdocs gh-deploy --force --clean --verbose \ No newline at end of file diff --git a/app/providers/anthropic/provider.py b/app/providers/anthropic/provider.py index 4555ebd..33195d2 100644 --- a/app/providers/anthropic/provider.py +++ b/app/providers/anthropic/provider.py @@ -25,7 +25,7 @@ def __init__(self, api_key: str): self.api_key = api_key self.client = anthropic.AsyncAnthropic(api_key=self.api_key) - def _prepare_messages_for_anthropic(self, messages: List[Dict[str, str]]) -> List[Dict[str, str]]: + def _prepare_messages_for_anthropic(self, messages: List) -> List[Dict[str, str]]: """ Prepare messages for Anthropic API format. @@ -33,7 +33,7 @@ def _prepare_messages_for_anthropic(self, messages: List[Dict[str, str]]) -> Lis ensure proper structure and handle any system messages appropriately. Args: - messages: List of messages in OpenAI format. + messages: List of ChatMessage objects. Returns: List of messages formatted for Anthropic API. @@ -41,8 +41,9 @@ def _prepare_messages_for_anthropic(self, messages: List[Dict[str, str]]) -> Lis anthropic_messages = [] for message in messages: - role = message["role"] - content = message["content"] + # Access Pydantic model attributes + role = message.role + content = message.content # Anthropic supports user, assistant, and system roles # System messages can be passed directly diff --git a/app/providers/google/provider.py b/app/providers/google/provider.py index fcb71a2..addd173 100644 --- a/app/providers/google/provider.py +++ b/app/providers/google/provider.py @@ -25,7 +25,7 @@ def __init__(self, api_key: str): self.api_key = api_key genai.configure(api_key=self.api_key) - def _translate_messages_to_google(self, messages: List[Dict[str, str]]) -> List[Dict[str, str]]: + def _translate_messages_to_google(self, messages: List) -> List[Dict[str, str]]: """ Translate OpenAI-format messages to Google Gemini format. @@ -33,7 +33,7 @@ def _translate_messages_to_google(self, messages: List[Dict[str, str]]) -> List[ Google uses: [{"role": "user", "parts": ["..."]}, {"role": "model", "parts": ["..."]}] Args: - messages: List of messages in OpenAI format. + messages: List of ChatMessage objects. Returns: List of messages in Google Gemini format. @@ -41,8 +41,9 @@ def _translate_messages_to_google(self, messages: List[Dict[str, str]]) -> List[ translated_messages = [] for message in messages: - role = message["role"] - content = message["content"] + # Access Pydantic model attributes + role = message.role + content = message.content # Map OpenAI roles to Google roles if role == "user": @@ -131,7 +132,7 @@ async def create_completion(self, request: ChatCompletionRequest) -> dict: google_messages = self._translate_messages_to_google(request.messages) # Estimate prompt tokens (rough approximation) - prompt_text = " ".join([msg["content"] for msg in request.messages]) + prompt_text = " ".join([msg.content for msg in request.messages]) prompt_tokens = len(prompt_text.split()) # Configure generation parameters