Skip to content
This repository was archived by the owner on Apr 22, 2024. It is now read-only.

Patch-1 #23

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
14 changes: 14 additions & 0 deletions ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from EdgeGPT.EdgeGPT import Chatbot as Bing
from EdgeGPT.EdgeGPT import ConversationStyle
from hugchat import hugchat
from claude import claude_client
from claude import claude_wrapper

MODELS = ["bard", "bing", "gpt", "hugchat", "llama"]

Expand Down Expand Up @@ -121,6 +123,18 @@ async def send(self, text):
else:
return response

# to use the claude api library https://github.com/AshwinPathi/claude-api-py
class ClaudeAPI:
def __init__(self, session_key):
self.client = claude_client.ClaudeClient(session_key)
organizations = self.client.get_organizations()
self.claude_obj = claude_wrapper.ClaudeWrapper(self.client, organization_uuid=organizations[0]['uuid'])
new_conversation_data = self.claude_obj.start_new_conversation("New Conversation", 'Hi how are you?')
self.conversation_uuid = new_conversation_data

async def send(self, text):
response = self.claude_obj.send_message(text, conversation_uuid=self.conversation_uuid)
return response

class HugchatAPI:
def __init__(self, cookie_path):
Expand Down