Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/crha-hfiecif/solid-tribble-translator

Developing(Holiday): Adding(API Gateway: FastAPI Python): Cohere Restful API in Go
https://github.com/crha-hfiecif/solid-tribble-translator

api-gateway cohere-ai fastapi golang ios-app postman restful-api

Last synced: 7 days ago
JSON representation

Developing(Holiday): Adding(API Gateway: FastAPI Python): Cohere Restful API in Go

Awesome Lists containing this project

README

        

# effective-octo-computing-machine - My Cohere API Project

This project provides a simple RESTful API interface for interacting with the Cohere AI model using go.

api_demo

## Getting Started

### Prerequisites

- Go 1.23.2 or later
- An API key from Cohere

### Setup

1. Clone the repository:

```bash
git clone https://github.com/yourusername/my-cohere-api.git
cd THIS-RESPOS-NAME
```

2. Create a `.env` file in the root of the project directory. This file should contain your Cohere API key.

Example `.env` file:
```plaintext
# This is an example .env file. Below is the way you should place your COHERE_API_KEY
# Assume your COHERE_API_KEY is "123456"
COHERE_API_KEY=123456
```

### Default Model

- The project defaults to the **Command R+ 08-2024** model from Cohere, which cannot be changed in the provided code.

### Running the Application

To start the server, use:

```bash
make start
```

### API Endpoint

- **POST** `/chat`
- Sends a message to the AI model and receives a response.

### Testing with Postman

To test the API using Postman, follow these steps:

1. Open Postman and create a new request.
2. Set the request type to **POST**.
3. Enter the URL: `http://localhost:8080/chat`.
4. Go to the **Headers** tab and set the **Content-Type** to `application/json`.
5. In the **Body** tab, select the **raw** option and choose **JSON** from the dropdown menu.
6. Enter the JSON payload, for example:

```json
{
"message": "Hello, AI!"
}

```

7. Send the request and observe the response.

api_post

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.