Learn everything from requesting a simple answer to making an entire chatbot backend
For text-to-text and text-image-to-text, Thyris has 3 endpoints you can use.
GET /api/text
This endpoint is used to give text with/without image to the LLM to get a response. That's it.
Parameters for this endpoint are:
model: string
Name of the model to be used. Supported models include thyris1-turbo, thyris1, and thyris1-pro
input: string
User's query to the LLM.
chat_history: Optional<string[][]>
The chat history as an array of arrays. Each sub-array will have 2 elements, first element is the user's message, and the second element is the assistant's message.
use_documents_from: Optional<string>
The collection to get the documents supplied into LLM for RAG.
n_documents: Optional<Integer>
It specifies the number of best matches to get from your document collection to supply into the LLM query. Default is 5.
This endpoint returns:
model: string
Name of the model used
created_at: integer
The time the request was created.
message: string
LLM's response
input_tokens_used: integer
Amount of tokens used in the input. This includes the chat history.
output_tokens_used: integer
Amount of tokens used in the output.
tokens_per_second: float
Average tokens/second of the response.
GET /api/embed/create_collection
The documents are stored in collections. You can create collections using this endpoint. This allows you to seperate your documents for different purposes.
The parameters for this endpoint are:
collection_name:
string The name of the collection of documents
documents: string[]
Array of documents to initialize the collection with. Every document needs to be converted into string beforehand.
n_chunks: Optional<Integer>
Number of chunks to divide each document into. It defaults to 7, and you can change it depending on your document length. If your documents' sizes are varying, you can use the following endpoint to specify different number of chunks for each document.
This endpoint returns a status code of 200/403/500
GET /api/embed/document
The documents are stored in collections. You can create collections using this endpoint. This allows you to seperate your documents for different purposes.
The parameters for this endpoint are:
collection_name:
string The name of the collection to insert the documents into.
documents: string[]
Array of documents to initialize the collection with. Every document needs to be converted into string beforehand.
n_chunks: Optional<Integer>
Number of chunks to divide each document into.
This endpoint returns a status code of 200/403/500
To use ThyrisAPI, you need to acquire an API key and pass it as Bearer Token to your request. Head over to [to-do] to get an API key.
{
"model": "thyris1-turbo",
"input": "Why is the sky blue?"
}
Here, we specify the model name and pass our input to get an answer. The response we get looks something like this:
{
"model": "thyris1-turbo",
"created_at": 1726010752206,
"message": "The sky blue color is due to the combination of blue and green primary colors in the visible spectrum. The blue component, which makes up the majority of the sky, is derived from the sun's ultraviolet rays that pass through Earth's atmosphere into space. As these rays interact with oxygen molecules in the upper atmosphere, they cause molecular bonds to break and produce tiny particles known as atoms or particles. These tiny particles, in turn, combine to form longer-wavelength blue light, which is then reflected back to Earth by the planet's surface. The green component of the sky, on the other hand, comes from plant life, especially photosynthesis, and the resultant green pigment that exists within plants. When these two primary colors combine in the atmosphere, they create the color blue.",
"input_tokens_used": 24,
"output_tokens_used": 155,
"tokens_per_second": 25.154581225407533
}
Let's say we want to make a collection to showcase the fun and interesting facts about city of Rochester, NY. We need to pass in the collection name and the documents we want to initialize the collection with. Here's an example:
{
"collection_name": "fun_facts_rochester",
"documents": ["Rochester is known as the birthplace of Eastman Kodak, which revolutionized photography in the late 19th century.", "Rochester is home to several major inventions, including the first commercial electrical generator and the first solid-body electric guitar.", "The Seneca Falls Convention, held in nearby Seneca Falls in 1848, was the first women's rights convention and marked a significant moment in the fight for women's suffrage."],
"n_chunks": 1
}
I wanted to specify the number of chunks to be 1, because the documents I passed are about a sentence or two each. So, the LLM should see all of it when I query it.
After we send this request, we should see a status code of 200 with a response of: Collection created successfully.
So, now that the LLM can get more detailed information about Rochester, let's see if it can answer a couple questions.
{
"model": "thyris1",
"created_at": 1726021212902,
"message": "According to the provided document, two significant inventions that took place in Rochester are:\n\n1. The first commercial electrical generator\n2. The first solid-body electric guitar\n\nThese notable innovations reflect the city's contributions to technological advancements and musical innovation!",
"input_tokens_used": 24,
"output_tokens_used": 48,
"tokens_per_second": 5.682266593007656
}
Great! Now we can ask our Thyris questions about our documents.
Now that we asked a question to Thyris, let's do a follow up question. Here, the chat_history
parameter will help us make a conversation with Thyris. Let's put the messages into a string[][]
and send the request:
{
"model": "thyris1",
"input": "Interesting. Can I learn more about the first thing? That sounds cool.",
"chat_history": [
["What are some inventions that occured in Rochester?", "According to the provided document, two significant inventions that took place in Rochester are:\n\n1. The first commercial electrical generator\n2. The first solid-body electric guitar\n\nThese notable innovations reflect the city's contributions to technological advancements and musical innovation!"]
]
}
Our response should look something like:
{
"model": "thyris1",
"created_at": 1726021354430,
"message": "The invention of the first commercial electrical generator is indeed a significant milestone in history.\n\nAs it turns out, that achievement took place at the Pittsford Power Station in Rochester, New York, around 1886. The inventor behind this innovation was Nikola Tesla's rival-turned-partner, George Westinghouse. However, another key figure, William Stanley Jr., played a crucial role in developing and commercializing the first alternating current (AC) system using transformers and generators.\n\nStanley's design improved upon earlier versions by introducing a more efficient and cost-effective way to transmit electrical power over long distances. This breakthrough paved the way for widespread electrification of homes, businesses, and industries across the United States.\n\nWould you like to know more about Nikola Tesla or William Stanley Jr.? Or perhaps explore other Rochester-related inventions?",
"input_tokens_used": 81,
"output_tokens_used": 162,
"tokens_per_second": 13.849310384133137
}