Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test file #84

Open
Nicat-dcw opened this issue Jul 22, 2023 · 2 comments
Open

Test file #84

Nicat-dcw opened this issue Jul 22, 2023 · 2 comments

Comments

@Nicat-dcw
Copy link

const axios = require("axios");

async function ask() {
  const objj = {
    messages: { prompt: "Hello" }, //[{" role":"user","content":"hello\n"},{"role":"assistant","content":"Hi there! How can I assist you today?"},{"role":"user","prompt":"who are you"}],
    model: "gpt-4"
  };

  try {
    const response = await axios.post(
      "http://127.0.0.1:3000/v1/chat/completions?site=better",{
      data: {
		prompt: "Hello",
  	    messages: { content: "Hello" }, //[{" role":"user","content":"hello\n"},{"role":"assistant","content":"Hi there! How can I assist you today?"},{"role":"user","prompt":"who are you"}],
        model: "gpt-4"  
	  }},
      {
		body: {
		 messages: { prompt: "Hello" }, //[{" role":"user","content":"hello\n"},{"role":"assistant","content":"Hi there! How can I assist you today?"},{"role":"user","prompt":"who are you"}],
         model: "gpt-4"	
		},
        headers: {
          "Content-Type": "application/json"
        }
      }
    );

    console.log(response.data.choices[0]);
  } catch (error) {
	console.error(error)
    console.error("Error making the request:", error.message);
  }
}

ask();

I trying this but server says need prompt in query

@Nicat-dcw
Copy link
Author

@xiangsx

@Nicat-dcw
Copy link
Author

Nicat-dcw commented Jul 22, 2023

I solved with some changes in index.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant