コヒア
Cohere ↗ は、実際のビジネス課題を解決するために設計されたAIモデルを構築します。
https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/cohere
Cohere ↗ にリクエストを送る際は、現在使用しているURLの https://api.cohere.ai/v1 を https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/cohere に置き換えてください。
curl https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/cohere/v1/chat \ --header 'Authorization: Token {cohere_api_token}' \ --header 'Content-Type: application/json' \ --data '{ "chat_history": [ {"role": "USER", "message": "重力を発見したのは誰ですか?"}, {"role": "CHATBOT", "message": "重力を発見したと広く認められているのはアイザック・ニュートン卿です"} ], "message": "彼は何年に生まれましたか?", "connectors": [{"id": "web-search"}]}'cohere-python-sdk ↗ を使用する場合は、エンドポイントを次のように設定します:
import cohereimport os
api_key = os.getenv('API_KEY')account_id = '{account_id}'gateway_id = '{gateway_id}'base_url = f"https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/cohere/v1"
co = cohere.Client( api_key=api_key, base_url=base_url,)
message = "こんにちは、世界!"model = "command-r-plus"
chat = co.chat( message=message, model=model)
print(chat)