Giter Site home page Giter Site logo

mockai's Introduction

MockAI

MockAI is a mock server for OpenAI's API. It allows you to simulate API responses for development and testing purposes.

Features

  • Supports the following endpoint.

    • /v1/completions
    • /v1/chat/completions
    • /v1/images/generations
  • Allows you to specify the type of mock response: echo, random, or fixed.

  • Supports both single responses and streaming responses.

  • Reads random responses from a text file.

Getting Started

  1. Install dependencies:
npm install
  1. Set env

Open .env file and set your environment.

SERVER_PORT=5002
MOCK_TYPE=random
MOCK_FILE_PATH=data/contents.txt
MOCK_FILE_SEPERATER="@@@@"
  1. Start server:
npm start

Environment Variables

  • SERVER_PORT: The port the server listens on.
  • DEFAULT_MOCK_TYPE: The default type of mock response.
  • MOCK_FILE_PATH: The path to the text file of random responses.
  • MOCK_FILE_SEPERATER: Random contents seperater. As there may be instances of line breaks or code outputs, it is not advisable to separate with line breaks.

Contributing

Contributions are welcome! Please submit a pull request or create an issue to get started.

mockai's People

Contributors

klauste avatar polly3d avatar

Stargazers

 avatar Surajit Dasgupta avatar Hansol Choe avatar Rodion Mostovoi avatar creeper12356 avatar Tamim Ibrahim avatar Juan avatar  avatar thetechoddbug (José María Gutiérrez) avatar Markus Rauhalahti avatar sugar avatar Divyansh Singh avatar  avatar  avatar Fan, Yi-Jie avatar Kfir avatar Erwin avatar  avatar Amadeo Pellicce avatar Gonzalo Faus Agulló avatar  avatar cuiwei avatar Ed Tee avatar  avatar Ael Gain avatar Rodrigo Martínez avatar Ibrahim H. avatar Matthew Martin avatar Nagesh Rao avatar Mufei avatar Daemon avatar Vasyl Dovhanchyn avatar Sabinaya KC avatar Mike DuPont avatar

Watchers

Gonzalo Faus Agulló avatar  avatar

mockai's Issues

Implement Network Latency Simulation

Overview

The purpose of this issue is to implement network latency simulation in the MockAI server to enhance testing capabilities by mimicking real-world network conditions.

Goals

  • Introduce a way to simulate minimum and maximum network delays.
  • Ensure that all API endpoints can receive and process the delay parameters.
  • Test the functionality to ensure it accurately reflects the specified network latencies.

Tasks

  • Update the README.md to include documentation on how to use the network latency simulation.
  • Modify the chat.js, embeddings.js, image.js, and text.js files to process the new minMsDelay and maxMsDelay parameters.
  • Implement a function to randomly generate delay times within the specified range.

Expected Impact

This feature will allow developers to better understand how their applications behave under various network conditions, leading to more robust and resilient systems.

Unable to Push Branches - Requesting Clarification on Contribution Guidelines

Issue Description

Hello! First off, I want to express how much I appreciate the project. The tools and features you have developed are very useful and I am keen to contribute. However, I have encountered a permission issue when trying to push branches.

Steps to Reproduce

  1. Attempted to push a new branch with the following command:

    git push origin feature/branch-name
  2. Received the following error:

    remote: Permission to polly3d/mockai.git denied to [your_username].
    fatal: unable to access 'https://github.com/polly3d/mockai.git/': The requested URL returned error: 403

Questions

  • Are external contributors allowed to push branches directly or should we fork the repository?
  • Are there any specific contribution guidelines or protocols that I should follow?

Thank you for your attention to this matter.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.