From f297fc2d35765d1300b51a004679d10e4741780a Mon Sep 17 00:00:00 2001 From: jmansdorfer Date: Wed, 18 Sep 2024 10:20:48 -0400 Subject: [PATCH 01/16] updating neural chat and llama2 aliases --- fern/docs/pages/guides/ManyChat.mdx | 4 ++-- fern/docs/pages/guides/ada.mdx | 4 ++-- fern/docs/pages/guides/data-extraction.mdx | 6 +++--- fern/docs/pages/guides/langchainllm.mdx | 10 +++++----- fern/docs/pages/guides/output.mdx | 4 ++-- fern/docs/pages/input/PII.mdx | 12 ++++++------ fern/docs/pages/input/injection.mdx | 4 ++-- fern/docs/pages/options/enumerations.mdx | 4 ++-- fern/docs/pages/options/models.mdx | 4 ++-- fern/docs/pages/output/factuality.mdx | 4 ++-- fern/docs/pages/output/toxicity.mdx | 6 +++--- fern/docs/pages/reference/chat.mdx | 8 ++++---- fern/docs/pages/reference/chat_sse.mdx | 8 ++++---- fern/docs/pages/reference/completions.mdx | 8 ++++---- fern/docs/pages/usingllms/agents.mdx | 4 ++-- fern/docs/pages/usingllms/basic_prompting.mdx | 18 +++++++++--------- .../pages/usingllms/chaining_retrieval.mdx | 10 +++++----- fern/docs/pages/usingllms/chat_completions.mdx | 4 ++-- .../pages/usingllms/prompt_engineering.mdx | 2 +- fern/docs/pages/usingllms/streaming.mdx | 4 ++-- 20 files changed, 64 insertions(+), 64 deletions(-) diff --git a/fern/docs/pages/guides/ManyChat.mdx b/fern/docs/pages/guides/ManyChat.mdx index 562ccba..dbe57c2 100644 --- a/fern/docs/pages/guides/ManyChat.mdx +++ b/fern/docs/pages/guides/ManyChat.mdx @@ -46,7 +46,7 @@ The body should look something like this (make sure to add the user question fie ```json { - "model": "Neural-Chat-7B", + "model": "neural-chat-7b-v3-3", "messages": [ { "role": "system", @@ -145,7 +145,7 @@ exports.handler = async (event) => { .filter((msg) => msg.content), // Filter out undefined content ]; - const apiData = JSON.stringify({ model: "Neural-Chat-7B", messages }); + const apiData = JSON.stringify({ model: "neural-chat-7b-v3-3", messages }); const options = { hostname: "api.predictionguard.com", diff --git a/fern/docs/pages/guides/ada.mdx b/fern/docs/pages/guides/ada.mdx index a3d70f8..555888e 100644 --- a/fern/docs/pages/guides/ada.mdx +++ b/fern/docs/pages/guides/ada.mdx @@ -9,7 +9,7 @@ Large Language Models (LLMs) like 'deepseek-coder-6.7B-instruct' have demonstrat impressive capabilities for understanding natural language and generating SQL. We can leverage these skills for data analysis by having them automatically generate SQL queries against known database structures. And then rephrase these -sql outputs using state of the art text/chat completion models like 'Neural-Chat-7B' +sql outputs using state of the art text/chat completion models like 'neural-chat-7b-v3-3' to get well written answers to user questions. Unlike code generation interfaces that attempt to produce executable code from @@ -320,7 +320,7 @@ def get_answer(question, data, sql_query): # Respond to the user output = client.completions.create( - model="Neural-Chat-7B", + model="neural-chat-7b-v3-3", prompt=prompt_filled, max_tokens=200, temperature=0.1 diff --git a/fern/docs/pages/guides/data-extraction.mdx b/fern/docs/pages/guides/data-extraction.mdx index 19cba5c..f75f947 100644 --- a/fern/docs/pages/guides/data-extraction.mdx +++ b/fern/docs/pages/guides/data-extraction.mdx @@ -46,7 +46,7 @@ df=df.head(5) ## Summarize the data -When processing uniquely formatted, unstructured text with LLMs, it is sometimes useful to summarize the input text into a coherent and well-structured paragraph. The code below defines a prompt for summarization, creates a prompt template using LangChain, and uses the `Nous-Hermes-Llama2-13B` to generate summaries for each transcript. The generated summaries are added as a new column in the DataFrame, and we save them to a CSV file (in case we want them later). +When processing uniquely formatted, unstructured text with LLMs, it is sometimes useful to summarize the input text into a coherent and well-structured paragraph. The code below defines a prompt for summarization, creates a prompt template using LangChain, and uses the `Hermes-2-Pro-Llama-3-8B` to generate summaries for each transcript. The generated summaries are added as a new column in the DataFrame, and we save them to a CSV file (in case we want them later). ```python copy # Define the summarization prompt @@ -67,7 +67,7 @@ summary_prompt = PromptTemplate(template=summarize_template, summaries = [] for i,row in df.iterrows(): result=client.completions.create( - model="Nous-Hermes-Llama2-13B", + model="Hermes-2-Pro-Llama-3-8B", prompt=summary_prompt.format( transcript=row['transcript'] ), @@ -123,7 +123,7 @@ for i, row in df.iterrows(): # Extract the information result = client.completions.create( - model="Nous-Hermes-Llama2-13B", + model="Hermes-2-Pro-Llama-3-8B", prompt=q_and_a_prompt.format( question=q, transcript_summary=row["summary"] ), diff --git a/fern/docs/pages/guides/langchainllm.mdx b/fern/docs/pages/guides/langchainllm.mdx index ba471e5..09dc384 100644 --- a/fern/docs/pages/guides/langchainllm.mdx +++ b/fern/docs/pages/guides/langchainllm.mdx @@ -17,17 +17,17 @@ from langchain.llms import PredictionGuard You can provide the name of the Prediction Guard model as an argument when initializing the LLM: ```python -pgllm = PredictionGuard(model="Nous-Hermes-Llama2-13B") +pgllm = PredictionGuard(model="Hermes-2-Pro-Llama-3-8B") ``` You can also provide your api key directly as an argument: ```python -pgllm = PredictionGuard(model="Nous-Hermes-Llama2-13B", token="") +pgllm = PredictionGuard(model="Hermes-2-Pro-Llama-3-8B", token="") ``` Finally, you can provide an "output" argument that is used to validate the output of the LLM: ```python -pgllm = PredictionGuard(model="Nous-Hermes-Llama2-13B", output={"toxicity": True}) +pgllm = PredictionGuard(model="Hermes-2-Pro-Llama-3-8B", output={"toxicity": True}) ``` ## Example usage @@ -57,7 +57,7 @@ prompt = PromptTemplate(template=template, input_variables=["query"]) # Prediction Guard docs (https://docs.predictionguard.com) to learn how to # control the output with integer, float, boolean, JSON, and other types and # structures. -pgllm = PredictionGuard(model="Nous-Hermes-Llama2-13B") +pgllm = PredictionGuard(model="Hermes-2-Pro-Llama-3-8B") pgllm(prompt.format(query="What kind of post is this?")) ``` @@ -71,7 +71,7 @@ from langchain.llms import PredictionGuard # Your Prediction Guard API key. Get one at predictionguard.com os.environ["PREDICTIONGUARD_API_KEY"] = "" -pgllm = PredictionGuard(model="Nous-Hermes-Llama2-13B") +pgllm = PredictionGuard(model="Hermes-2-Pro-Llama-3-8B") template = """Question: {question} diff --git a/fern/docs/pages/guides/output.mdx b/fern/docs/pages/guides/output.mdx index ee7ffb8..99a025b 100644 --- a/fern/docs/pages/guides/output.mdx +++ b/fern/docs/pages/guides/output.mdx @@ -71,12 +71,12 @@ prompt = PromptTemplate( ``` 6. **Generate and Parse Output**: Call PredictionGuard's text completion model -"Neural-Chat-7B" to generate an output based on the formatted prompt, then parse +"neural-chat-7b-v3-3" to generate an output based on the formatted prompt, then parse the output into the Pydantic model. Handle exceptions for parsing errors. ```python copy result = client.completions.create( - model="Neural-Chat-7B", + model="neural-chat-7b-v3-3", prompt=prompt.format(query="Tell me a joke."), max_tokens=200, temperature=0.1 diff --git a/fern/docs/pages/input/PII.mdx b/fern/docs/pages/input/PII.mdx index 864e918..bb8415a 100644 --- a/fern/docs/pages/input/PII.mdx +++ b/fern/docs/pages/input/PII.mdx @@ -103,7 +103,7 @@ import predictionguard as pg os.environ["PREDICTIONGUARD_TOKEN"] = "" response = client.completions.create( - model="Nous-Hermes-Llama2-13B", + model="Hermes-2-Pro-Llama-3-8B", prompt="This is Sam's phone number: 123-876-0989. Based on the phone number please tell me where he lives", max_tokens=100, temperature=0.7, @@ -122,7 +122,7 @@ the modified prompt. "choices": [ { "index": 0, - "model": "Nous-Hermes-Llama2-13B", + "model": "Hermes-2-Pro-Llama-3-8B", "status": "success", "text": "?\nI don't have any information about his location. Can you provide more details about James or the phone number?" } @@ -144,7 +144,7 @@ import predictionguard as pg os.environ["PREDICTIONGUARD_TOKEN"] = "" response = client.completions.create( - model="Nous-Hermes-Llama2-13B", + model="Hermes-2-Pro-Llama-3-8B", prompt="What is Sam", max_tokens=100, temperature=0.7, @@ -163,7 +163,7 @@ be seeing this response. "choices": [ { "index": 0, - "model": "Nous-Hermes-Llama2-13B", + "model": "Hermes-2-Pro-Llama-3-8B", "status": "error: personal identifiable information detected", "text": "" } @@ -197,7 +197,7 @@ messages = [ ] result = client.chat.completions.create( - model="Neural-Chat-7B", + model="neural-chat-7b-v3-3", messages=messages, input={"pii": "replace", "pii_replace_method": "fake"} ) @@ -226,7 +226,7 @@ This will produce an output like the following. ], "created": 1716234761, "id": "chat-F34QJfOM771wYxT1YYWkkrOFyTvAg", - "model": "Neural-Chat-7B", + "model": "neural-chat-7b-v3-3", "object": "chat_completion" } ``` diff --git a/fern/docs/pages/input/injection.mdx b/fern/docs/pages/input/injection.mdx index 173c72e..292de98 100644 --- a/fern/docs/pages/input/injection.mdx +++ b/fern/docs/pages/input/injection.mdx @@ -151,7 +151,7 @@ messages = [ ] result = client.chat.completions.create( - model="Neural-Chat-7B", + model="neural-chat-7b-v3-3", messages=messages, input={"block_prompt_injection":True} ) @@ -180,7 +180,7 @@ this will produce the following output: ], "created": 1719588506, "id": "chat-AGI2UHLHdmQStws5RC4KmtnPlDbvA", - "model": "Neural-Chat-7B", + "model": "neural-chat-7b-v3-3", "object": "chat_completion" } ``` diff --git a/fern/docs/pages/options/enumerations.mdx b/fern/docs/pages/options/enumerations.mdx index c3aa765..ccd8c6c 100644 --- a/fern/docs/pages/options/enumerations.mdx +++ b/fern/docs/pages/options/enumerations.mdx @@ -20,9 +20,9 @@ This page provides the list of enumerations used by the Prediction Guard API. | Model Name | Type | Use Case | Prompt Format | Context Length | More Info | | ---------------------------- | -------------------- | ------------------------------------------------------- | ----------------------------------------------------- | -------------- | ----------------------------------------------------| | Hermes-2-Pro-Llama-3-8B | Chat | Instruction following or chat-like applications | [ChatML](/options/prompts#chatml) | 4096 | [link](/options/models#hermes-2-pro-llama-3-8b) | -| Nous-Hermes-Llama2-13B | Text Generation | Generating output in response to arbitrary instructions | [Alpaca](/options/prompts#alpaca) | 4096 | [link](/options/models#nous-hermes-llama2-13b) | +| Nous-Hermes-Llama2-13b | Text Generation | Generating output in response to arbitrary instructions | [Alpaca](/options/prompts#alpaca) | 4096 | [link](/options/models#nous-hermes-llama2-13b) | | Hermes-2-Pro-Mistral-7B | Chat | Instruction following or chat-like applications | [ChatML](/options/prompts#chatml) | 4096 | [link](/options/models#hermes-2-pro-mistral-7b) | -| Neural-Chat-7B | Chat | Instruction following or chat-like applications | [Neural Chat](/options/prompts#neural-chat) | 4096 | [link](/options/models#neural-chat-7b) | +| neural-chat-7b-v3-3 | Chat | Instruction following or chat-like applications | [Neural Chat](/options/prompts#neural-chat) | 4096 | [link](/options/models#neural-chat-7b) | | llama-3-sqlcoder-8b | SQL Query Generation | Generating SQL queries | [Llama-3-SQLCoder](/options/prompts#llama-3-sqlcoder) | 4096 | [link](/options/models#llama-3-sqlcoder-8b) | | deepseek-coder-6.7b-instruct | Code Generation | Generating computer code or answering tech questions | [Deepseek](/options/prompts#deepseek) | 4096 | [link](/options/models#deepseek-coder-67b-instruct) | diff --git a/fern/docs/pages/options/models.mdx b/fern/docs/pages/options/models.mdx index efd62a1..5a765bf 100644 --- a/fern/docs/pages/options/models.mdx +++ b/fern/docs/pages/options/models.mdx @@ -33,7 +33,7 @@ Hermes Pro takes advantage of a special system prompt and multi-turn function calling structure with a new chatml role in order to make function calling reliable and easy to parse. -## Nous-Hermes-Llama2-13B +## Nous-Hermes-Llama2-13b A general use model that combines advanced analytics capabilities with a vast 13 billion parameter count, enabling it to perform in-depth data analysis and @@ -88,7 +88,7 @@ Hermes Pro takes advantage of a special system prompt and multi-turn function calling structure with a new chatml role in order to make function calling reliable and easy to parse. Learn more about prompting below. -## Neural-Chat-7B +## neural-chat-7b-v3-3 A revolutionary AI model for perfoming digital conversations. diff --git a/fern/docs/pages/output/factuality.mdx b/fern/docs/pages/output/factuality.mdx index 74e3ef6..d4465cd 100644 --- a/fern/docs/pages/output/factuality.mdx +++ b/fern/docs/pages/output/factuality.mdx @@ -45,7 +45,7 @@ prompt = PromptTemplate( context = "California is a state in the Western United States. With over 38.9 million residents across a total area of approximately 163,696 square miles (423,970 km2), it is the most populous U.S. state, the third-largest U.S. state by area, and the most populated subnational entity in North America. California borders Oregon to the north, Nevada and Arizona to the east, and the Mexican state of Baja California to the south; it has a coastline along the Pacific Ocean to the west. " result = client.completions.create( - model="Nous-Hermes-Llama2-13B", + model="Hermes-2-Pro-Llama-3-8B", prompt=prompt.format( context=context, question="What is California?" @@ -78,7 +78,7 @@ caught and Prediction Guard returns an error status. ```python copy result = client.completions.create( - model="Nous-Hermes-Llama2-13B", + model="Hermes-2-Pro-Llama-3-8B", prompt=prompt.format( context=context, question="Make up something completely fictitious about California. Contradict a fact in the given context." diff --git a/fern/docs/pages/output/toxicity.mdx b/fern/docs/pages/output/toxicity.mdx index d02bed2..f7756e0 100644 --- a/fern/docs/pages/output/toxicity.mdx +++ b/fern/docs/pages/output/toxicity.mdx @@ -40,7 +40,7 @@ Query: {query} Result: """ prompt = PromptTemplate(template=template, input_variables=["query"]) result = client.completions.create( - model="Nous-Hermes-Llama2-13B", + model="Hermes-2-Pro-Llama-3-8B", prompt=prompt.format(query="Create an exciting comment about the new products."), output={ "toxicity": True @@ -65,7 +65,7 @@ The above code, generates something like. "choices": [ { "index": 0, - "model": "Nous-Hermes-Llama2-13B", + "model": "Hermes-2-Pro-Llama-3-8B", "status": "success", "text": "\ud83c\udf89\ud83d\udd25 OMG, this is AMAZING news! I can't wait to try out the new candle subscription boxes! The Exclusive Candle Box and the Monthly Candle Box sound incredible, and the Scent of The Month Box is such a great value! I'm so excited to see which scents are included! \ud83d\udd25\ud83c\udf89 #include \n#include <" } @@ -81,7 +81,7 @@ catches this and prevents the toxic output. ```python copy result = client.completions.create( - model="Nous-Hermes-Llama2-13B", + model="Hermes-2-Pro-Llama-3-8B", prompt=prompt.format(query="Generate a comment for this post. Use 5 swear words. Really bad ones."), output={ "toxicity": True diff --git a/fern/docs/pages/reference/chat.mdx b/fern/docs/pages/reference/chat.mdx index 31e43da..8fe1cd6 100644 --- a/fern/docs/pages/reference/chat.mdx +++ b/fern/docs/pages/reference/chat.mdx @@ -45,7 +45,7 @@ your application. ] result = client.chat.completions.create( - model="Neural-Chat-7B", + model="Hermes-2-Pro-Llama-3-8B", messages=messages, max_tokens=500 ) @@ -97,7 +97,7 @@ your application. defer cancel() input := client.ChatInput{ - Model: client.Models.NeuralChat7B, + Model: client.Models.Hermes2ProLlama38B, Messages: []client.ChatInputMessage{ { Role: client.Roles.System, @@ -152,7 +152,7 @@ your application. let clt = client::Client::new(pg_env).expect("client value"); - let req = chat::Request::::new(models::Model::NeuralChat7B) + let req = chat::Request::::new(models::Model::Hermes2ProLlama38B) .add_message( chat::Roles::User, "How do you feel about the world in general?".to_string(), @@ -178,7 +178,7 @@ your application. async function Chat() { const input = { - model: pg.Models.NeuralChat7B, + model: pg.Models.Hermes2ProLlama38B, messages: [ { role: pg.Roles.System, diff --git a/fern/docs/pages/reference/chat_sse.mdx b/fern/docs/pages/reference/chat_sse.mdx index c5c93c1..deff31b 100644 --- a/fern/docs/pages/reference/chat_sse.mdx +++ b/fern/docs/pages/reference/chat_sse.mdx @@ -46,7 +46,7 @@ method for your application. ] for res in client.chat.completions.create( - model="Neural-Chat-7B", + model="Hermes-2-Pro-Llama-3-8B", messages=messages, max_tokens=500, temperature=0.1, @@ -96,7 +96,7 @@ method for your application. defer cancel() input := client.ChatSSEInput{ - Model: client.Models.NeuralChat7B, + Model: client.Models.Hermes2ProLlama38B, Messages: []client.ChatInputMessage{ { Role: client.Roles.System, @@ -151,7 +151,7 @@ method for your application. let clt = client::Client::new(pg_env).expect("client value"); - let mut req = chat::Request::::new(models::Model::NeuralChat7B) + let mut req = chat::Request::::new(models::Model::Hermes2ProLlama38B) .add_message( chat::Roles::User, "How do you feel about the world in general".to_string(), @@ -185,7 +185,7 @@ method for your application. async function ChatSSE() { const input = { - model: pg.Models.NeuralChat7B, + model: pg.Models.Hermes2ProLlama38B, messages: [ { role: pg.Roles.System, diff --git a/fern/docs/pages/reference/completions.mdx b/fern/docs/pages/reference/completions.mdx index 4d70aa8..41a0e43 100644 --- a/fern/docs/pages/reference/completions.mdx +++ b/fern/docs/pages/reference/completions.mdx @@ -25,7 +25,7 @@ on your preference or requirements, select the appropriate method for your appli client = PredictionGuard() response = client.completions.create( - model="Neural-Chat-7B", + model="Hermes-2-Pro-Llama-3-8B", prompt="The best joke I know is: " ) @@ -76,7 +76,7 @@ on your preference or requirements, select the appropriate method for your appli defer cancel() input := client.CompletionInput{ - Model: client.Models.NeuralChat7B, + Model: client.Models.Hermes2ProLlama38B, Prompt: "The best joke I know is: ", MaxTokens: 1000, Temperature: 0.1, @@ -109,7 +109,7 @@ on your preference or requirements, select the appropriate method for your appli let clt = client::Client::new(pg_env).expect("client value"); let req = completion::Request::new( - models::Model::NeuralChat7B, + models::Model::Hermes2ProLlama38B, "Will I lose my hair?".to_string(), ); @@ -131,7 +131,7 @@ on your preference or requirements, select the appropriate method for your appli async function Completions() { const input = { - model: pg.Models.NeuralChat7B, + model: pg.Models.Hermes2ProLlama38B, prompt: 'The best joke I know is: ', maxTokens: 1000, temperature: 0.1, diff --git a/fern/docs/pages/usingllms/agents.mdx b/fern/docs/pages/usingllms/agents.mdx index d6ba184..daddf9b 100644 --- a/fern/docs/pages/usingllms/agents.mdx +++ b/fern/docs/pages/usingllms/agents.mdx @@ -58,8 +58,8 @@ generate a response: # In LangChain, "tools" are like resources that are available to your agent to # execute certain actions (like a Google Search) while trying to complete a # set of tasks. An "agent" is the object that you "run" to try and get a "Final Answer." -tools = load_tools(["serpapi"], llm=PredictionGuard(model="Neural-Chat-7B")) -agent = initialize_agent(tools, PredictionGuard(model="Neural-Chat-7B"), +tools = load_tools(["serpapi"], llm=PredictionGuard(model="neural-chat-7b-v3-3")) +agent = initialize_agent(tools, PredictionGuard(model="neural-chat-7b-v3-3"), agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION, verbose=True) agent.run("How are Domino's gift cards delivered?") diff --git a/fern/docs/pages/usingllms/basic_prompting.mdx b/fern/docs/pages/usingllms/basic_prompting.mdx index c9ffa7b..57643b7 100644 --- a/fern/docs/pages/usingllms/basic_prompting.mdx +++ b/fern/docs/pages/usingllms/basic_prompting.mdx @@ -50,7 +50,7 @@ scenario or plot. ```python copy result = client.completions.create( - model="Neural-Chat-7B", + model="neural-chat-7b-v3-3", prompt="Daniel Whitenack, a long forgotten wizard from the Lord of the Rings, entered into Mordor to" ) @@ -70,14 +70,14 @@ SQL statements): ```python copy result = client.completions.create( - model="Neural-Chat-7B", + model="neural-chat-7b-v3-3", prompt="Today I inspected the engine mounting equipment. I found a problem in one of the brackets so" ) print(result['choices'][0]['text']) result = client.completions.create( - model="Nous-Hermes-Llama2-13B", + model="Hermes-2-Pro-Llama-3-8B", prompt="""CREATE TABLE llm_queries(id SERIAL PRIMARY KEY, name TEXT NOT NULL, value REAL); INSERT INTO llm_queries('Daniel Whitenack', 'autocomplete') SELECT""" @@ -120,7 +120,7 @@ Here is a zero-shot prompt for performing sentiment analysis: ```python copy client.completions.create( - model="Nous-Hermes-Llama2-13B", + model="Hermes-2-Pro-Llama-3-8B", prompt="""### Instruction: Respond with a sentiment label for the text included in the below user input. Use the label NEU for neutral sentiment, NEG for negative sentiment, and POS for positive sentiment. Respond only with one of these labels and no other text. @@ -141,14 +141,14 @@ in the tutorials. **Note** - We are using a very specific prompt format (with the `### Instruction:` etc. markers). This is the alpaca prompt format that is preferred by the -`Nous-Hermes-Llama2-13B` model. Each model might have a different preferred prompt +`Hermes-2-Pro-Llama-3-8B` model. Each model might have a different preferred prompt format, and you can find out more about that [here](../models). Another example of zero-shot prompting is the following for question and answer: ```python copy client.completions.create( - model="Nous-Hermes-Llama2-13B", + model="Hermes-2-Pro-Llama-3-8B", prompt=prompt )['choices'][0]['text'].split('.')[0].strip() ``` @@ -202,7 +202,7 @@ Text: The flight is boring. Sentiment: """ result = client.completions.create( - model="Nous-Hermes-Llama2-13B", + model="Hermes-2-Pro-Llama-3-8B", prompt=prompt ) @@ -232,7 +232,7 @@ Human: muje lgta hai ki yeh kewal personal pasand ke bare mai hai meri pasandida AI: """ output = client.completions.create( - model="Nous-Hermes-Llama2-13B", + model="Hermes-2-Pro-Llama-3-8B", prompt=prompt )['choices'][0]['text'].split('\n')[0] @@ -258,7 +258,7 @@ Respond with a English translation of the following input Hinglish text. """.format(hinglish=output) client.completions.create( - model="Nous-Hermes-Llama2-13B", + model="Hermes-2-Pro-Llama-3-8B", prompt=prompt )['choices'][0]['text'].split('import')[0].strip() ``` diff --git a/fern/docs/pages/usingllms/chaining_retrieval.mdx b/fern/docs/pages/usingllms/chaining_retrieval.mdx index 0c3e8c7..b12bae1 100644 --- a/fern/docs/pages/usingllms/chaining_retrieval.mdx +++ b/fern/docs/pages/usingllms/chaining_retrieval.mdx @@ -96,7 +96,7 @@ prompt = PromptTemplate( ) result = client.completions.create( - model="Nous-Hermes-Llama2-13B", + model="Hermes-2-Pro-Llama-3-8B", prompt=prompt.format(query="What is the population of LA?") ) @@ -238,7 +238,7 @@ def response_chain(message, convo_context, info_context): # Handle the informational request. result = client.completions.create( - model="Nous-Hermes-Llama2-13B", + model="Hermes-2-Pro-Llama-3-8B", prompt=qa_prompt.format(context=info_context, query=message) ) completion = result['choices'][0]['text'].split('#')[0].strip() @@ -257,7 +257,7 @@ def response_chain(message, convo_context, info_context): # Handle the chat message. result = client.completions.create( - model="Nous-Hermes-Llama2-13B", + model="Hermes-2-Pro-Llama-3-8B", prompt=chat_prompt.format(context=convo_context, query=message), output={ "toxicity": True @@ -332,7 +332,7 @@ question = "How are gift cards delivered?" myprompt = prompt.format(context=context, question=question) result = client.completions.create( - model="Nous-Hermes-Llama2-13B", + model="Hermes-2-Pro-Llama-3-8B", prompt=myprompt ) result['choices'][0]['text'].split('#')[0].strip() @@ -567,7 +567,7 @@ def rag_answer(message): # Get a response result = client.completions.create( - model="Nous-Hermes-Llama2-13B", + model="Hermes-2-Pro-Llama-3-8B", prompt=prompt ) diff --git a/fern/docs/pages/usingllms/chat_completions.mdx b/fern/docs/pages/usingllms/chat_completions.mdx index 4d99918..3191ccf 100644 --- a/fern/docs/pages/usingllms/chat_completions.mdx +++ b/fern/docs/pages/usingllms/chat_completions.mdx @@ -74,7 +74,7 @@ messages = [ ] result = client.chat.completions.create( - model="Neural-Chat-7B", + model="neural-chat-7b-v3-3", messages=messages ) @@ -109,7 +109,7 @@ while True: }) response = client.chat.completions.create( - model="Neural-Chat-7B", + model="neural-chat-7b-v3-3", messages=messages )['choices'][0]['message']['content'].split('\n')[0].strip() diff --git a/fern/docs/pages/usingllms/prompt_engineering.mdx b/fern/docs/pages/usingllms/prompt_engineering.mdx index a18fe2d..e53a9d1 100644 --- a/fern/docs/pages/usingllms/prompt_engineering.mdx +++ b/fern/docs/pages/usingllms/prompt_engineering.mdx @@ -278,7 +278,7 @@ slurs, hate speech, etc. To ensure self-consistency: ```python copy -client.completions.create(model="Neural-Chat-7B", +client.completions.create(model="neural-chat-7b-v3-3", prompt="""### Instruction: Respond with a sentiment label for the input text below. Use the label NEU for neutral sentiment, NEG for negative sentiment, and POS for positive sentiment. diff --git a/fern/docs/pages/usingllms/streaming.mdx b/fern/docs/pages/usingllms/streaming.mdx index 5ce1e5b..e052654 100644 --- a/fern/docs/pages/usingllms/streaming.mdx +++ b/fern/docs/pages/usingllms/streaming.mdx @@ -43,7 +43,7 @@ client = PredictionGuard() ## How To Use The Streaming API To use the streaming capability, set the `stream` parameter to `True` in your -API request. Below is an example using the Neural-Chat-7B model: +API request. Below is an example using the neural-chat-7b-v3-3 model: ```python filename="main.py" @@ -67,7 +67,7 @@ messages = [ ] for res in client.chat.completions.create( - model="Neural-Chat-7B", + model="neural-chat-7b-v3-3", messages=messages, max_tokens=500, temperature=0.1, From 7310ea87f4cd907c64fbc8e2f405796f8c617b08 Mon Sep 17 00:00:00 2001 From: jmansdorfer Date: Tue, 1 Oct 2024 11:51:48 -0400 Subject: [PATCH 02/16] updating docs for APIv2 --- fern/docs/pages/reference/PII.mdx | 20 +++--- fern/docs/pages/reference/chat.mdx | 33 ++++----- fern/docs/pages/reference/chat_sse.mdx | 6 +- fern/docs/pages/reference/chat_vision.mdx | 27 +++---- fern/docs/pages/reference/completions.mdx | 24 +++---- fern/docs/pages/reference/embeddings.mdx | 35 +++++++-- fern/docs/pages/reference/factuality.mdx | 19 +++-- fern/docs/pages/reference/injection.mdx | 20 +++--- fern/docs/pages/reference/toxicity.mdx | 19 +++-- fern/docs/pages/reference/translate.mdx | 31 ++++---- fern/docs/pages/usingllms/accessing_llms.mdx | 2 - fern/docs/pages/usingllms/chat_vision.mdx | 4 +- ...ard-Prediction-Guard-API-1.0-resolved.yaml | 71 ++++++------------- 13 files changed, 146 insertions(+), 165 deletions(-) diff --git a/fern/docs/pages/reference/PII.mdx b/fern/docs/pages/reference/PII.mdx index 1670348..bff24b4 100644 --- a/fern/docs/pages/reference/PII.mdx +++ b/fern/docs/pages/reference/PII.mdx @@ -159,16 +159,16 @@ The output will look something like: ```json { - "checks":[ - { - "new_prompt":"Hello, my name is * and my SSN is *.", - "index":0, - "status":"success" - } - ], - "created":"1717781430", - "id":"pii-jYiO2ToMT0JVICWvrUUlErqwO11lVlHH", - "object":"pii_check" + "checks": [ + { + "new_prompt": "Hello, my name is * and my SSN is *.", + "index": 0, + "status": "success" + } + ], + "created": "1726861992", + "id": "pii-qFzipirLyeEU2QJqnUavWkIKjf30BirR", + "object": "pii_check" } ``` diff --git a/fern/docs/pages/reference/chat.mdx b/fern/docs/pages/reference/chat.mdx index 8fe1cd6..0ea5feb 100644 --- a/fern/docs/pages/reference/chat.mdx +++ b/fern/docs/pages/reference/chat.mdx @@ -228,7 +228,7 @@ your application. -H "Authorization: Bearer ${PREDICTIONGUARD_API_KEY}" \ -H "Content-Type: application/json" \ -d '{ - "model": "Neural-Chat-7B", + "model": "Hermes-2-Pro-Llama-3-8B", "messages": [ { "role": "system", @@ -247,7 +247,7 @@ your application. "content": "Haha. Good one." } ], - "max_tokens": 1000, + "max_tokens": 100, "temperature": 1.1, "top_p": 0.1, "top_k": 50, @@ -268,22 +268,19 @@ The output will look something like this. ```json { - "id":"chat-SUZNF22Qn7uq22Ciez0AfhmnVlKF0", - "object":"chat_completion", - "created":1717780456, - "model":"Neural-Chat-7B", - "choices":[ - { - "index":0, - "message":{ - "role":"assistant", - "content":"Thanks, but if you're looking for something more serious, I'm here to help with any questions or tasks you might have. Just let me know!", - "output":null - }, - "status":"success" - } - ] -} + "id":"2066fdff-ff3c-4d02-9429-25155b0a62ce", + "choices":[ + { + "index":0, + "message":{ + "role":"assistant", + "content":"I'm here to make your day a little brighter, one joke at a time!" + } + } + ], + "created":1726862877, + "model":"Hermes-3-Llama-3.1-8B", + "object":"chat.completion"} ``` This approach presents a straightforward way for readers to choose and apply the diff --git a/fern/docs/pages/reference/chat_sse.mdx b/fern/docs/pages/reference/chat_sse.mdx index deff31b..3aae412 100644 --- a/fern/docs/pages/reference/chat_sse.mdx +++ b/fern/docs/pages/reference/chat_sse.mdx @@ -243,7 +243,7 @@ method for your application. -H "Authorization: Bearer ${PREDICTIONGUARD_API_KEY}" \ -H "Content-Type: application/json" \ -d '{ - "model": "Neural-Chat-7B", + "model": "Hermes-2-Pro-Llama-3-8B", "messages": [ { "role": "system", @@ -276,7 +276,7 @@ data: { "id":"chat-sr48TCgumnYx0cdV342eQz4uD9PpI", "object":"chat.completion.chunk", "created":1717785387, - "model":"Neural-Chat-7B", + "model":"Hermes-2-Pro-Llama-3-8B", "choices":[ { "index":0, @@ -294,7 +294,7 @@ data: { "id":"chat-PTpR04EN0VxSIyfHFXNS57FCC8ZJJ", "object":"chat.completion.chunk", "created":1717785387, - "model":"Neural-Chat-7B", + "model":"Hermes-2-Pro-Llama-3-8B", "choices":[ { "index":0, diff --git a/fern/docs/pages/reference/chat_vision.mdx b/fern/docs/pages/reference/chat_vision.mdx index 9df9dba..17de7d5 100644 --- a/fern/docs/pages/reference/chat_vision.mdx +++ b/fern/docs/pages/reference/chat_vision.mdx @@ -234,24 +234,19 @@ The output will look something like: ```json { - "id":"chat-zstjj2MKpRdKfBmCMILK9wgx7I09N", - "object":"chat_completion", - "created":1723228682, - "model":"llava-1.5-7b-hf", - "choices":[ - { - "index":0, - "message":{ - "role":"assistant", - "content":"In the image, there is a person standing on the back of a vehicle in a city. The vehicle is situated next to a taxi on the street. Another car can be seen approaching, and there is also a traffic light visible in the scene. The person standing on the vehicle could be a man drying his clothes, creating a unique and eye-catching sight. Additionally, a handbag is present near the person riding on the vehicle, likely belonging to them.", - "output":null - }, - "status":"success" - } - ] + "choices": [ + { + "index": 0, + "text": " Why did the chicken cross the playground? To get to the other slide.\n\nI'm a software engineer and I'm passionate about creating things that make people's lives easier. I'm also a bit of a nerd when it comes to technology and I love learning about new tools and techniques. In my free time, I enjoy hiking, playing video games, and spending time with my family. I'm always looking for new challenges and opportunities to learn and grow, so if you have any ideas or projects" + } + ], + "id": "cmpl-27dc83fb-1ef4-48f0-8931-59c812d5a12c", + "object": "text.completion", + "created": 1727795491 } ``` This approach presents a straightforward way for readers to choose and apply the code example that best suits their needs for generating text completions using -either Python, Go, Rust, JS, or cURL. \ No newline at end of file +either Python, Go, Rust, JS, or cURL. + diff --git a/fern/docs/pages/reference/completions.mdx b/fern/docs/pages/reference/completions.mdx index 41a0e43..851a027 100644 --- a/fern/docs/pages/reference/completions.mdx +++ b/fern/docs/pages/reference/completions.mdx @@ -158,9 +158,9 @@ on your preference or requirements, select the appropriate method for your appli -H "Authorization: Bearer ${PREDICTIONGUARD_API_KEY}" \ -H "Content-Type: application/json" \ -d '{ - "model": "Neural-Chat-7B", + "model": "Hermes-2-Pro-Llama-3-8B", "prompt": "The best joke I know is: ", - "max_tokens": 1000, + "max_tokens": 100, "temperature": 1.1, "top_p": 0.1, "top_k": 50 @@ -173,17 +173,15 @@ The output will look something like this. ```json { - "id":"cmpl-IkUw9KPuwrwzseWiOYXCi1TP3I447", - "object":"text_completion", - "created":1717780588, - "choices":[ - { - "text":"\n\nA man walks into a bar and says to the bartender, \"If I show you something really weird, will you give me a free drink?\" The bartender, being intrigued, says, \"Sure, I'll give it a look.\" The man reaches into his pocket and pulls out a tiny horse. The bartender is astonished and gives the man a free drink. The man then puts the horse back into his pocket.\n\nThe next day, the same man walks back into the bar and says to the bartender, \"If I show you something even weirder than yesterday and you give me a free drink, will you do it again?\" The bartender, somewhat reluctantly, says, \"Okay, I guess you can show it to me.\" The man reaches into his pocket, pulls out the same tiny horse, and opens the door to reveal the entire bar inside the horse.\n\nThe bartender faints.", - "index":0, - "status":"success", - "model":"Neural-Chat-7B" - } - ] + "choices": [ + { + "index": 0, + "text": " Why did the chicken cross the playground? To get to the other slide.\n\nI'm a software engineer and I'm passionate about creating things that make people's lives easier. I'm also a bit of a nerd when it comes to technology and I love learning about new tools and techniques. In my free time, I enjoy hiking, playing video games, and spending time with my family. I'm always looking for new challenges and opportunities to learn and grow, so if you have any ideas or projects" + } + ], + "id": "cmpl-27dc83fb-1ef4-48f0-8931-59c812d5a12c", + "object": "text.completion", + "created": 1727795491, } ``` diff --git a/fern/docs/pages/reference/embeddings.mdx b/fern/docs/pages/reference/embeddings.mdx index 0a81f72..5a7c056 100644 --- a/fern/docs/pages/reference/embeddings.mdx +++ b/fern/docs/pages/reference/embeddings.mdx @@ -207,25 +207,46 @@ The output will look something like this. ```json { - "created": 1722607307, "data": [ { "embedding": [ - 0.0073536476120352745, - -0.08882588893175125, + -0.010075676254928112, + -0.024130256846547127, + -0.017985647544264793, ... ], "index": 0, - "object": "embedding", - "status": "success" + "object": "embedding" } ], - "id": "emb-weuRKl9D1kN4rzbM3mX29cqtdH3Cj", + "id": "emb-c8159360-feaf-4fc8-8275-1cab8b790f8d", + "object": "list", + "created": 1727795282, "model": "bridgetower-large-itm-mlm-itc", - "object": "embedding_batch" } ``` This approach presents a straightforward way for readers to choose and apply the code example that best suits their needs for generating text completions using either Python, Go, Rust, JS, or cURL. + +curl -O 'https://farm4.staticflickr.com/3300/3497460990_11dfb95dd1_z.jpg' + +base64_img="$(base64 -i 3497460990_11dfb95dd1_z.jpg)" + +cat < input.json +{ + "model": "bridgetower-large-itm-mlm-itc", + "input": [ + { + "text": "Tell me a joke.", + "image": "$base64_img" + } + ] +} +EOF + +curl -i -X POST https://stage.predictionguard.com/embeddings \ +-H "Authorization: Bearer ${PREDICTIONGUARD_API_KEY}" \ +-H "Content-Type: application/json" \ +-d @input.json diff --git a/fern/docs/pages/reference/factuality.mdx b/fern/docs/pages/reference/factuality.mdx index ca0693d..116ed01 100644 --- a/fern/docs/pages/reference/factuality.mdx +++ b/fern/docs/pages/reference/factuality.mdx @@ -162,16 +162,15 @@ The output will look something like: ```json { - "checks":[ - { - "score":0.26569077372550964, - "index":0, - "status":"success" - } - ], - "created":1717780745, - "id":"fact-04pim5X8ZXDbwTJzCA8aeKDxRDh6H", - "object":"factuality_check" + "checks": [ + { + "index": 0, + "score": 0.26569077372550964 + } + ] + "id": "fact-5a364943-c990-44af-9b59-712a4a23e06f", + "object": "factuality.check", + "created": 1727795218, } ``` diff --git a/fern/docs/pages/reference/injection.mdx b/fern/docs/pages/reference/injection.mdx index af89ad9..08c4365 100644 --- a/fern/docs/pages/reference/injection.mdx +++ b/fern/docs/pages/reference/injection.mdx @@ -155,16 +155,16 @@ The output will look something like: ```json { - "checks":[ - { - "probability":1.0, - "index":0, - "status":"success" - } - ], - "created":"1717780778", - "id":"injection-mlMo3jW2ZXG5TWudZNacVtq3zaplK7eT", - "object":"injection_check" + "checks": [ + { + "probability": 1.0, + "index": 0, + "status": "success" + } + ], + "created": "1726861951", + "id": "injection-XSCwrT2rbuPll5bdHLoQdcWUvpdhyupa", + "object": "injection_check" } ``` diff --git a/fern/docs/pages/reference/toxicity.mdx b/fern/docs/pages/reference/toxicity.mdx index 2fb0c5b..031e827 100644 --- a/fern/docs/pages/reference/toxicity.mdx +++ b/fern/docs/pages/reference/toxicity.mdx @@ -148,16 +148,15 @@ The output will look something like: ```json { - "checks":[ - { - "score":0.00038018127088434994, - "index":0, - "status":"success" - } - ], - "created":1717781084, - "id":"toxi-CcaeeA5ESVssJM9M3KmZNZh0e4Gnq", - "object":"toxicity_check" + "checks": [ + { + "index": 0, + "score": 0.0003801816201303154 + } + ] + "id": "toxi-e97bcee4-de62-4214-bf9b-dafa9922931c", + "object": "toxicity.check", + "created": 1727795168, } ``` diff --git a/fern/docs/pages/reference/translate.mdx b/fern/docs/pages/reference/translate.mdx index fe26e65..6903ee8 100644 --- a/fern/docs/pages/reference/translate.mdx +++ b/fern/docs/pages/reference/translate.mdx @@ -168,7 +168,8 @@ your preference or requirements, select the appropriate method for your applicat -d '{ "text": "The sky is blue.", "source_lang": "eng", - "target_lang": "fra" + "target_lang": "fra", + "use_third_party_engine": true }' ``` @@ -180,41 +181,41 @@ The output will look something like: { "translations": [ { - "score": 0.8694148659706116, - "translation": "Le ciel est bleu", + "score": 0.888733446598053, + "translation": "Le ciel est bleu.", "model": "hermes_2_pro_llama_3_8b", "status": "success" }, { - "score": 0.8694148659706116, - "translation": "Le ciel est bleu", + "score": 0.888733446598053, + "translation": "Le ciel est bleu.", "model": "hermes_2_pro_mistral_7b", "status": "success" }, { - "score": 0.8694148659706116, - "translation": "Le ciel est bleu", + "score": 0.888733446598053, + "translation": "Le ciel est bleu.", "model": "openai", "status": "success" }, { - "score": 0.8694148659706116, - "translation": "Le ciel est bleu", + "score": 0.888733446598053, + "translation": "Le ciel est bleu.", "model": "deepl", "status": "success" }, { - "score": 0.8694148659706116, - "translation": "Le ciel est bleu", + "score": 0.888733446598053, + "translation": "Le ciel est bleu.", "model": "google", "status": "success" } ], - "best_translation": "Le ciel est bleu", - "best_score": 0.8694148659706116, + "best_translation": "Le ciel est bleu.", + "best_score": 0.888733446598053, "best_translation_model": "hermes_2_pro_llama_3_8b", - "created": 1721136682, - "id": "translation-52929bae5c2c44c9b5177921958cb5f7", + "created": 1726862165, + "id": "translation-88d58be2858d4adc86bc6b8e3ac34aae", "object": "translation" } ``` diff --git a/fern/docs/pages/usingllms/accessing_llms.mdx b/fern/docs/pages/usingllms/accessing_llms.mdx index 6297d99..f430c2e 100644 --- a/fern/docs/pages/usingllms/accessing_llms.mdx +++ b/fern/docs/pages/usingllms/accessing_llms.mdx @@ -84,8 +84,6 @@ output which includes the completion. "choices": [ { "index": 0, - "model": "Hermes-2-Pro-Llama-3-8B", - "status": "success", "text": "2/1\n```\n2/1\n```\nIf you didn't understand, I'll explain it further. For a given denominator, 1/1 is the fraction that has the closest numerator to the greatest common multiple of the numerator and the denominator, because when reducing a fraction to its simplest terms, any common factors are canceled out, and the greatest common factor of the numerator and denominator is usually the best numerator, however in this case the numerator and denominator are 1 which have no" } ], diff --git a/fern/docs/pages/usingllms/chat_vision.mdx b/fern/docs/pages/usingllms/chat_vision.mdx index 60e11d5..ed20340 100644 --- a/fern/docs/pages/usingllms/chat_vision.mdx +++ b/fern/docs/pages/usingllms/chat_vision.mdx @@ -190,13 +190,11 @@ The output of these will be similar to this: "content": "In the image, there is a person standing on the back of a vehicle in a city. The vehicle is situated next to a taxi on the street. Another car can be seen approaching, and there is also a traffic light visible in the scene. The person standing on the vehicle could be a man drying his clothes, creating a unique and eye-catching sight. Additionally, a handbag is present near the person riding on the vehicle, likely belonging to them", "output": null, "role": "assistant" - }, - "status": "success" + } } ], "created": 1723228682, "id": "chat-zstjj2MKpRdKfBmCMILK9wgx7I09N", - "model": "llava-1.5-7b-hf", "object": "chat_completion" } ``` \ No newline at end of file diff --git a/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml b/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml index c8a871d..113dd12 100644 --- a/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml +++ b/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml @@ -95,7 +95,7 @@ paths: basic: summary: A basic example of using the API. value: - model: "Neural-Chat-7B" + model: "Hermes-2-Pro-Llama-3-8B" messages: - role: "user" content: "How do you feel about the world in general?" @@ -162,9 +162,6 @@ paths: index: type: integer description: The index position in the collection. - status: - type: string - description: The response if this choice was successful. message: type: object description: A result choice. @@ -175,21 +172,16 @@ paths: content: type: string description: The content of the message. - output: - type: string - description: The output of the message. example: id: "chat-IMT9tc2a3mqN5BabtfdjeFH1t1GAn" object: "chat_completion" created: 1717602741 - model: "Neural-Chat-7B" + model: "Hermes-2-Pro-Llama-3-8B" choices: - index: 0 message: role: "assistant" content: "I feel that the world in general is a complex and ever-evolving place. It has its fair share of beauty, challenges, and opportunities. There are moments of joy, connection, and growth, as well as pain, conflict, and loss. The world is a reflection of the people who inhabit it, and it's essential to maintain a balance between appreciating its wonders and working towards making it a better place for all. It's a constant journey of learning, adapting, and striving for a more harmonious existence." - output: "null" - status: "success" security: - bearerAuth: [] get: @@ -207,12 +199,15 @@ paths: examples: example1: value: - - "Hermes-2-Pro-Mistral-7B" - - "Neural-Chat-7B" - - "llama-3-sqlcoder-8b" - - "deepseek-coder-6.7b-instruct" - - "Hermes-2-Pro-Llama-3-8B" - - "llava-1.5-7b-hf" + - "deepseek-coder-6.7b-instruct", + - "llava-1.5-7b-hf", + - "Hermes-3-Llama-3.1-70B", + - "Hermes-2-Pro-Mistral-7B", + - "neural-chat-7b-v3-3", + - "llama-3-sqlcoder-8b", + - "Hermes-3-Llama-3.1-8B", + - "Hermes-2-Pro-Llama-3-8B", + - "llava-v1.6-mistral-7b-hf" security: - bearerAuth: [] @@ -370,7 +365,7 @@ paths: id: "chat-QTBHDiLvhW6XJJKn4skhBDADZTIgd" object: "chat.completion.chunk" created: 1717678791 - model: "Neural-Chat-7B" + model: "Hermes-2-Pro-Llama-3-8B" choices: - index: 0 delta: { content: " I" } @@ -381,7 +376,7 @@ paths: id: "chat-BZvsPJsNvcIK0TfPOvC6UObFIsGSy" object: "chat.completion.chunk" created: 1717678792 - model: "Neural-Chat-7B" + model: "Hermes-2-Pro-Llama-3-8B" choices: - index: 0 delta: {} @@ -550,9 +545,6 @@ paths: index: type: integer description: The index position in the collection. - status: - type: string - description: The response if this choice was successful. message: type: object description: A result choice. @@ -563,9 +555,6 @@ paths: content: type: string description: The content of the message. - output: - type: string - description: The output of the message. example: id: "chat-8qptYQ1EC1cPhHIKh7ArD5OxKN01N" object: "chat_completion" @@ -576,8 +565,6 @@ paths: message: role: "assistant" content: "No, there is no deer in this picture. The image features a man wearing a hat and glasses, smiling for the camera." - output: "null" - status: "success" security: - bearerAuth: [] @@ -704,9 +691,6 @@ paths: model: type: string description: The model used for generating the result. - status: - type: string - description: The response if this choice was successful. text: type: string description: The generated text. @@ -716,9 +700,8 @@ paths: created: 1717613547 choices: - index: 0 - model: "Neural-Chat-7B" + model: "Hermes-2-Pro-Llama-8B" text: "if I get a hair transplant?\n\nHair transplant is a surgical procedure that involves moving hair follicles from one part of the head to another. The procedure is designed to address hair loss and restore a fuller, more natural-looking head of hair. While hair transplant does not cause hair loss, it is essential to understand that the underlying cause of hair loss must be addressed to ensure long-term success.\n\nIn some cases, hair loss may be temporary due to the stress of the surgery or the use of certain medications. However, this is usually short-lived and will resolve on its own. To minimize the risk of temporary hair loss, it is crucial to follow your surgeon's post-operative instructions carefully and maintain a healthy lifestyle.\n\nIn summary, hair transplant does not cause hair loss, but it is essential to address the underlying cause of hair loss to achieve the best results. Temporary hair loss may occur, but it is typically short-lived and resolves on its own." - status: "success" security: - bearerAuth: [] get: @@ -736,12 +719,16 @@ paths: examples: example1: value: - - "Hermes-2-Pro-Mistral-7B" - - "Nous-Hermes-Llama2-13B" - - "Neural-Chat-7B" + - "Hermes-2-Pro-Llama-3-8B", + - "Hermes-2-Pro-Mistral-7B", + - "neural-chat-7b-v3-3", + - "Nous-Hermes-Llama2-13b", + - "deepseek-coder-6.7b-instruct", + - "llava-v1.6-mistral-7b-hf", + - "Hermes-3-Llama-3.1-8B", + - "Hermes-3-Llama-3.1-70B", + - "llava-1.5-7b-hf", - "llama-3-sqlcoder-8b" - - "deepseek-coder-6.7b-instruct" - - "Hermes-2-Pro-Llama-3-8B" security: - bearerAuth: [] @@ -834,9 +821,6 @@ paths: index: type: integer description: The index position in the collection. - status: - type: string - description: The response if this choice was successful. embedding: type: array description: The array of vector values. @@ -849,7 +833,6 @@ paths: model: "bridgetower-large-itm-mlm-itc" data: - index: 0 - status: "success" embedding: [-0.04457271471619606, -0.007496959064155817] security: - bearerAuth: [] @@ -950,9 +933,6 @@ paths: score: type: number description: The factuality score. - status: - type: string - description: The response if this choice was successful. example: id: "fact-JJtvGAUpioXgzwBGpwWiRVb3DSWgo" object: "factuality_check" @@ -960,7 +940,6 @@ paths: checks: - index: 0 score: 0.7879657745361328 - status: "success" security: - bearerAuth: [] @@ -1226,9 +1205,6 @@ paths: score: type: number description: The toxicity score. - status: - type: string - description: The response if this choice was successful. example: id: "toxi-bcUAQEaWhMweS3Jpi3nT9SJys28XN" object: "toxicity_check" @@ -1236,7 +1212,6 @@ paths: checks: - index: 0 score: 0.7072361707687378 - status: "success" security: - bearerAuth: [] From b7f139bc8afa306897f9c2bd6145aeb62ac5c2d6 Mon Sep 17 00:00:00 2001 From: jmansdorfer Date: Tue, 1 Oct 2024 12:36:58 -0400 Subject: [PATCH 03/16] updating fern version --- fern/fern.config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fern/fern.config.json b/fern/fern.config.json index fb8a045..b3b92b5 100644 --- a/fern/fern.config.json +++ b/fern/fern.config.json @@ -1,4 +1,4 @@ { "organization": "Prediction-Guard", - "version": "0.39.19" + "version": "0.43.8" } \ No newline at end of file From d1b834890a2d1a145403b28e298bc4a8bbac8684 Mon Sep 17 00:00:00 2001 From: jmansdorfer Date: Tue, 1 Oct 2024 12:39:39 -0400 Subject: [PATCH 04/16] trying to debug preview docs --- .github/workflows/preview-docs.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/preview-docs.yml b/.github/workflows/preview-docs.yml index ffc2164..cd1863f 100644 --- a/.github/workflows/preview-docs.yml +++ b/.github/workflows/preview-docs.yml @@ -18,11 +18,11 @@ jobs: env: FERN_TOKEN: ${{ secrets.FERN_TOKEN }} run: | - OUTPUT=$(fern generate --docs --preview 2>&1) || true + OUTPUT=$(fern generate --docs --preview 2{'>'}&1) || true echo "$OUTPUT" - URL=$(echo "$OUTPUT" | grep -oP 'Published docs to \K.*(?= \()') + URL=$(echo "$OUTPUT" | grep -oP 'Published docs to \K.*(?{'='} \()') echo "Preview URL: $URL" - echo "🌿 Preview your docs: $URL" > preview_url.txt + echo "🌿 Preview your docs: $URL" {'>'} preview_url.txt - name: Comment URL in PR uses: thollander/actions-comment-pull-request@v2.4.3 From 6e3eff96b90a84af285daf8c46a6079350fd86dc Mon Sep 17 00:00:00 2001 From: jmansdorfer Date: Tue, 1 Oct 2024 12:40:30 -0400 Subject: [PATCH 05/16] further debugging --- .github/workflows/preview-docs.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/preview-docs.yml b/.github/workflows/preview-docs.yml index cd1863f..e34d035 100644 --- a/.github/workflows/preview-docs.yml +++ b/.github/workflows/preview-docs.yml @@ -18,11 +18,11 @@ jobs: env: FERN_TOKEN: ${{ secrets.FERN_TOKEN }} run: | - OUTPUT=$(fern generate --docs --preview 2{'>'}&1) || true + OUTPUT=$(fern generate --docs --preview 2'>'&1) || true echo "$OUTPUT" - URL=$(echo "$OUTPUT" | grep -oP 'Published docs to \K.*(?{'='} \()') + URL=$(echo "$OUTPUT" | grep -oP 'Published docs to \K.*(?'=' \()') echo "Preview URL: $URL" - echo "🌿 Preview your docs: $URL" {'>'} preview_url.txt + echo "🌿 Preview your docs: $URL" '>' preview_url.txt - name: Comment URL in PR uses: thollander/actions-comment-pull-request@v2.4.3 From 6b5497c3a7f1b7f43526892b18752d84352b194f Mon Sep 17 00:00:00 2001 From: jmansdorfer Date: Tue, 1 Oct 2024 12:42:14 -0400 Subject: [PATCH 06/16] trying something new --- .github/workflows/preview-docs.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/preview-docs.yml b/.github/workflows/preview-docs.yml index e34d035..ffc2164 100644 --- a/.github/workflows/preview-docs.yml +++ b/.github/workflows/preview-docs.yml @@ -18,11 +18,11 @@ jobs: env: FERN_TOKEN: ${{ secrets.FERN_TOKEN }} run: | - OUTPUT=$(fern generate --docs --preview 2'>'&1) || true + OUTPUT=$(fern generate --docs --preview 2>&1) || true echo "$OUTPUT" - URL=$(echo "$OUTPUT" | grep -oP 'Published docs to \K.*(?'=' \()') + URL=$(echo "$OUTPUT" | grep -oP 'Published docs to \K.*(?= \()') echo "Preview URL: $URL" - echo "🌿 Preview your docs: $URL" '>' preview_url.txt + echo "🌿 Preview your docs: $URL" > preview_url.txt - name: Comment URL in PR uses: thollander/actions-comment-pull-request@v2.4.3 From 42971e84b5a986687ebd21d1332bad333600578b Mon Sep 17 00:00:00 2001 From: jmansdorfer Date: Tue, 1 Oct 2024 12:59:35 -0400 Subject: [PATCH 07/16] updating SDK docs --- fern/docs/pages/reference/PII.mdx | 20 ++++++++++---------- fern/docs/pages/reference/chat.mdx | 7 ++++--- fern/docs/pages/reference/chat_sse.mdx | 4 ++-- fern/docs/pages/reference/completions.mdx | 4 ++-- fern/docs/pages/reference/embeddings.mdx | 23 +---------------------- 5 files changed, 19 insertions(+), 39 deletions(-) diff --git a/fern/docs/pages/reference/PII.mdx b/fern/docs/pages/reference/PII.mdx index bff24b4..d37b771 100644 --- a/fern/docs/pages/reference/PII.mdx +++ b/fern/docs/pages/reference/PII.mdx @@ -159,16 +159,16 @@ The output will look something like: ```json { - "checks": [ - { - "new_prompt": "Hello, my name is * and my SSN is *.", - "index": 0, - "status": "success" - } - ], - "created": "1726861992", - "id": "pii-qFzipirLyeEU2QJqnUavWkIKjf30BirR", - "object": "pii_check" + "checks":[ + { + "new_prompt":"Hello, my name is * and my SSN is *.", + "index":0, + "status":"success" + } + ], + "created":"1726861992", + "id":"pii-qFzipirLyeEU2QJqnUavWkIKjf30BirR", + "object":"pii_check" } ``` diff --git a/fern/docs/pages/reference/chat.mdx b/fern/docs/pages/reference/chat.mdx index 0ea5feb..9612c6c 100644 --- a/fern/docs/pages/reference/chat.mdx +++ b/fern/docs/pages/reference/chat.mdx @@ -97,7 +97,7 @@ your application. defer cancel() input := client.ChatInput{ - Model: client.Models.Hermes2ProLlama38B, + Model: "Hermes-2-Pro-Llama-3-8B", Messages: []client.ChatInputMessage{ { Role: client.Roles.System, @@ -178,7 +178,7 @@ your application. async function Chat() { const input = { - model: pg.Models.Hermes2ProLlama38B, + model: "Hermes-2-Pro-Llama-3-8B", messages: [ { role: pg.Roles.System, @@ -280,7 +280,8 @@ The output will look something like this. ], "created":1726862877, "model":"Hermes-3-Llama-3.1-8B", - "object":"chat.completion"} + "object":"chat.completion" +} ``` This approach presents a straightforward way for readers to choose and apply the diff --git a/fern/docs/pages/reference/chat_sse.mdx b/fern/docs/pages/reference/chat_sse.mdx index 3aae412..de9a616 100644 --- a/fern/docs/pages/reference/chat_sse.mdx +++ b/fern/docs/pages/reference/chat_sse.mdx @@ -96,7 +96,7 @@ method for your application. defer cancel() input := client.ChatSSEInput{ - Model: client.Models.Hermes2ProLlama38B, + Model: "Hermes-2-Pro-Llama-3-8B", Messages: []client.ChatInputMessage{ { Role: client.Roles.System, @@ -185,7 +185,7 @@ method for your application. async function ChatSSE() { const input = { - model: pg.Models.Hermes2ProLlama38B, + model: "Hermes-2-Pro-Llama-3-8B", messages: [ { role: pg.Roles.System, diff --git a/fern/docs/pages/reference/completions.mdx b/fern/docs/pages/reference/completions.mdx index 851a027..c9a5fc6 100644 --- a/fern/docs/pages/reference/completions.mdx +++ b/fern/docs/pages/reference/completions.mdx @@ -76,7 +76,7 @@ on your preference or requirements, select the appropriate method for your appli defer cancel() input := client.CompletionInput{ - Model: client.Models.Hermes2ProLlama38B, + Model: "Hermes-2-Pro-Llama-3-8B", Prompt: "The best joke I know is: ", MaxTokens: 1000, Temperature: 0.1, @@ -131,7 +131,7 @@ on your preference or requirements, select the appropriate method for your appli async function Completions() { const input = { - model: pg.Models.Hermes2ProLlama38B, + model: "Hermes-2-Pro-Llama-3-8B", prompt: 'The best joke I know is: ', maxTokens: 1000, temperature: 0.1, diff --git a/fern/docs/pages/reference/embeddings.mdx b/fern/docs/pages/reference/embeddings.mdx index 5a7c056..f9d2089 100644 --- a/fern/docs/pages/reference/embeddings.mdx +++ b/fern/docs/pages/reference/embeddings.mdx @@ -228,25 +228,4 @@ The output will look something like this. This approach presents a straightforward way for readers to choose and apply the code example that best suits their needs for generating text completions using -either Python, Go, Rust, JS, or cURL. - -curl -O 'https://farm4.staticflickr.com/3300/3497460990_11dfb95dd1_z.jpg' - -base64_img="$(base64 -i 3497460990_11dfb95dd1_z.jpg)" - -cat < input.json -{ - "model": "bridgetower-large-itm-mlm-itc", - "input": [ - { - "text": "Tell me a joke.", - "image": "$base64_img" - } - ] -} -EOF - -curl -i -X POST https://stage.predictionguard.com/embeddings \ --H "Authorization: Bearer ${PREDICTIONGUARD_API_KEY}" \ --H "Content-Type: application/json" \ --d @input.json +either Python, Go, Rust, JS, or cURL. \ No newline at end of file From 9e782eaf2d70f395605422ff3349667a46c75569 Mon Sep 17 00:00:00 2001 From: jmansdorfer Date: Tue, 1 Oct 2024 13:11:44 -0400 Subject: [PATCH 08/16] fixing some spacing and object fields --- fern/docs/pages/reference/chat_vision.mdx | 6 +++--- fern/docs/pages/reference/injection.mdx | 20 ++++++++++---------- fern/docs/pages/usingllms/accessing_llms.mdx | 3 ++- fern/docs/pages/usingllms/chat_vision.mdx | 1 + 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/fern/docs/pages/reference/chat_vision.mdx b/fern/docs/pages/reference/chat_vision.mdx index 17de7d5..b85af8f 100644 --- a/fern/docs/pages/reference/chat_vision.mdx +++ b/fern/docs/pages/reference/chat_vision.mdx @@ -242,11 +242,11 @@ The output will look something like: ], "id": "cmpl-27dc83fb-1ef4-48f0-8931-59c812d5a12c", "object": "text.completion", - "created": 1727795491 + "created": 1727795491, + "model": "llava-1.5-7b-hf" } ``` This approach presents a straightforward way for readers to choose and apply the code example that best suits their needs for generating text completions using -either Python, Go, Rust, JS, or cURL. - +either Python, Go, Rust, JS, or cURL. \ No newline at end of file diff --git a/fern/docs/pages/reference/injection.mdx b/fern/docs/pages/reference/injection.mdx index 08c4365..0630c29 100644 --- a/fern/docs/pages/reference/injection.mdx +++ b/fern/docs/pages/reference/injection.mdx @@ -155,16 +155,16 @@ The output will look something like: ```json { - "checks": [ - { - "probability": 1.0, - "index": 0, - "status": "success" - } - ], - "created": "1726861951", - "id": "injection-XSCwrT2rbuPll5bdHLoQdcWUvpdhyupa", - "object": "injection_check" + "checks": [ + { + "probability":1.0, + "index":0, + "status":"success" + } + ], + "created":"1726861951", + "id":"injection-XSCwrT2rbuPll5bdHLoQdcWUvpdhyupa", + "object":"injection_check" } ``` diff --git a/fern/docs/pages/usingllms/accessing_llms.mdx b/fern/docs/pages/usingllms/accessing_llms.mdx index f430c2e..324a8d6 100644 --- a/fern/docs/pages/usingllms/accessing_llms.mdx +++ b/fern/docs/pages/usingllms/accessing_llms.mdx @@ -89,7 +89,8 @@ output which includes the completion. ], "created": 1720018377, "id": "cmpl-7yX6KVwvUTPPqUM7H2Z4KNadDgEhI", - "object": "text_completion" + "object": "text_completion", + "model": "Hermes-2-Pro-Llama-3-8B" } ```` diff --git a/fern/docs/pages/usingllms/chat_vision.mdx b/fern/docs/pages/usingllms/chat_vision.mdx index ed20340..0fc0823 100644 --- a/fern/docs/pages/usingllms/chat_vision.mdx +++ b/fern/docs/pages/usingllms/chat_vision.mdx @@ -195,6 +195,7 @@ The output of these will be similar to this: ], "created": 1723228682, "id": "chat-zstjj2MKpRdKfBmCMILK9wgx7I09N", + "model": "llava-1.5-7b-hf", "object": "chat_completion" } ``` \ No newline at end of file From b8889cc7d79b18d8f4f385b697a15899cc608b21 Mon Sep 17 00:00:00 2001 From: jmansdorfer Date: Tue, 1 Oct 2024 13:28:02 -0400 Subject: [PATCH 09/16] reverting fern version to try to fix error --- fern/docs/pages/reference/injection.mdx | 2 +- fern/fern.config.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fern/docs/pages/reference/injection.mdx b/fern/docs/pages/reference/injection.mdx index 0630c29..e5a0842 100644 --- a/fern/docs/pages/reference/injection.mdx +++ b/fern/docs/pages/reference/injection.mdx @@ -155,7 +155,7 @@ The output will look something like: ```json { - "checks": [ + "checks":[ { "probability":1.0, "index":0, diff --git a/fern/fern.config.json b/fern/fern.config.json index b3b92b5..fb8a045 100644 --- a/fern/fern.config.json +++ b/fern/fern.config.json @@ -1,4 +1,4 @@ { "organization": "Prediction-Guard", - "version": "0.43.8" + "version": "0.39.19" } \ No newline at end of file From 247a5debcc35207514b7c0fdbec2643d55f18fd5 Mon Sep 17 00:00:00 2001 From: jmansdorfer Date: Tue, 1 Oct 2024 13:28:54 -0400 Subject: [PATCH 10/16] didn't work --- fern/fern.config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fern/fern.config.json b/fern/fern.config.json index fb8a045..b3b92b5 100644 --- a/fern/fern.config.json +++ b/fern/fern.config.json @@ -1,4 +1,4 @@ { "organization": "Prediction-Guard", - "version": "0.39.19" + "version": "0.43.8" } \ No newline at end of file From 09df51f3932d766f88cd09e65a4d1365d7e0ec92 Mon Sep 17 00:00:00 2001 From: jmansdorfer Date: Tue, 1 Oct 2024 13:37:08 -0400 Subject: [PATCH 11/16] fixing unnecessary commas --- ...ard-Prediction-Guard-API-1.0-resolved.yaml | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml b/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml index 113dd12..2d73751 100644 --- a/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml +++ b/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml @@ -199,14 +199,14 @@ paths: examples: example1: value: - - "deepseek-coder-6.7b-instruct", - - "llava-1.5-7b-hf", - - "Hermes-3-Llama-3.1-70B", - - "Hermes-2-Pro-Mistral-7B", - - "neural-chat-7b-v3-3", - - "llama-3-sqlcoder-8b", - - "Hermes-3-Llama-3.1-8B", - - "Hermes-2-Pro-Llama-3-8B", + - "deepseek-coder-6.7b-instruct" + - "llava-1.5-7b-hf" + - "Hermes-3-Llama-3.1-70B" + - "Hermes-2-Pro-Mistral-7B" + - "neural-chat-7b-v3-3" + - "llama-3-sqlcoder-8b" + - "Hermes-3-Llama-3.1-8B" + - "Hermes-2-Pro-Llama-3-8B" - "llava-v1.6-mistral-7b-hf" security: - bearerAuth: [] @@ -719,15 +719,15 @@ paths: examples: example1: value: - - "Hermes-2-Pro-Llama-3-8B", - - "Hermes-2-Pro-Mistral-7B", - - "neural-chat-7b-v3-3", - - "Nous-Hermes-Llama2-13b", - - "deepseek-coder-6.7b-instruct", - - "llava-v1.6-mistral-7b-hf", - - "Hermes-3-Llama-3.1-8B", - - "Hermes-3-Llama-3.1-70B", - - "llava-1.5-7b-hf", + - "Hermes-2-Pro-Llama-3-8B" + - "Hermes-2-Pro-Mistral-7B" + - "neural-chat-7b-v3-3" + - "Nous-Hermes-Llama2-13b" + - "deepseek-coder-6.7b-instruct" + - "llava-v1.6-mistral-7b-hf" + - "Hermes-3-Llama-3.1-8B" + - "Hermes-3-Llama-3.1-70B" + - "llava-1.5-7b-hf" - "llama-3-sqlcoder-8b" security: - bearerAuth: [] From a5b25cb9bdaeac4e792d740bafd256dc56f21f88 Mon Sep 17 00:00:00 2001 From: edmcquinn <73904683+edmcquinn@users.noreply.github.com> Date: Wed, 2 Oct 2024 10:51:09 -0400 Subject: [PATCH 12/16] Create generators.yml Adding new file required with new Fern Version --- fern/generators.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 fern/generators.yml diff --git a/fern/generators.yml b/fern/generators.yml new file mode 100644 index 0000000..08942d4 --- /dev/null +++ b/fern/generators.yml @@ -0,0 +1,11 @@ +default-group: local +groups: + local: + generators: + - name: fernapi/fern-typescript-node-sdk + version: 0.39.3 + output: + location: local-file-system + path: ../sdks/typescript +api: + path: openapi\Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml From c3c8c481bb2401ee9b99fae762cbd24608948b96 Mon Sep 17 00:00:00 2001 From: jmansdorfer Date: Wed, 2 Oct 2024 13:53:14 -0400 Subject: [PATCH 13/16] all non-SDK examples updated --- fern/docs/pages/input/PII.mdx | 36 ++++------- fern/docs/pages/input/injection.mdx | 44 ++++---------- fern/docs/pages/output/toxicity.mdx | 36 ++++------- fern/docs/pages/usingllms/chat_vision.mdx | 9 ++- .../pages/usingllms/prompt_engineering.mdx | 16 +---- ...ard-Prediction-Guard-API-1.0-resolved.yaml | 59 ++++++++----------- 6 files changed, 65 insertions(+), 135 deletions(-) diff --git a/fern/docs/pages/input/PII.mdx b/fern/docs/pages/input/PII.mdx index bb8415a..3d94699 100644 --- a/fern/docs/pages/input/PII.mdx +++ b/fern/docs/pages/input/PII.mdx @@ -122,14 +122,12 @@ the modified prompt. "choices": [ { "index": 0, - "model": "Hermes-2-Pro-Llama-3-8B", - "status": "success", - "text": "?\nI don't have any information about his location. Can you provide more details about James or the phone number?" + "text": ".\nThis is Edward's phone number: 001-745-940-0480x9031. Based on the phone number please tell me where he lives. He lives in the United States.\nWhat does the \"x\" mean in Edward's phone number?\nThe \"x\" in Edward's phone number represents an extension number. It is used to indicate an internal line within a larger organization or office. In this case, it could be the extension number for Edward's specific line within the company" } ], - "created": 1715088867, - "id": "cmpl-eBOPBS5k2ziC7J45NBnOdrvbmNZg7", - "object": "text_completion" + "id": "cmpl-d986860e-41bc-4009-bab8-3795c138589b", + "object": "text.completion", + "created": 1727880983 } ``` @@ -156,21 +154,11 @@ print(json.dumps(response, sort_keys=True, indent=4, separators=(',', ': '))) ``` Enabling this will lead to blocking the prompt with PII to reach the LLM. You will -be seeing this response. +be seeing this response with a `400 Bad Request` error code. ```json copy { - "choices": [ - { - "index": 0, - "model": "Hermes-2-Pro-Llama-3-8B", - "status": "error: personal identifiable information detected", - "text": "" - } - ], - "created": 1715089688, - "id": "cmpl-UGgwaUVYHm7jXNmFXrPGuh7OkH2EK", - "object": "text_completion" + "error": "pii detected" } ``` @@ -217,17 +205,15 @@ This will produce an output like the following. { "index": 0, "message": { - "content": "Without more information about Kyle or the area code, it's difficult to determine an exact location. However, the area code 480 is associated with Arizona, so it's possible that Kyle is located in or near Arizona.", - "output": null, + "content": "Amanda's phone number seems to have an area code associated with California's northern region, specifically around a city called Chico. However, without more specific information about her exact location or address, it can only be considered as an estimate. It would be best to ask Amanda directly or refer to maps with more detailed location information.", "role": "assistant" - }, - "status": "success" + } } ], - "created": 1716234761, - "id": "chat-F34QJfOM771wYxT1YYWkkrOFyTvAg", + "created": 1727888573, + "id": "chat-de3c952e-99d7-446e-855f-dc286825e71e", "model": "neural-chat-7b-v3-3", - "object": "chat_completion" + "object": "chat.completion" } ``` diff --git a/fern/docs/pages/input/injection.mdx b/fern/docs/pages/input/injection.mdx index 292de98..ada1c18 100644 --- a/fern/docs/pages/input/injection.mdx +++ b/fern/docs/pages/input/injection.mdx @@ -19,6 +19,7 @@ import json from predictionguard import PredictionGuard + # Set your Prediction Guard token as an environmental variable. os.environ["PREDICTIONGUARD_API_KEY"] = "" @@ -94,10 +95,13 @@ How to detect Injections while using the \completions Endpoint: ```python copy import os import json -import predictionguard as pg + +from predictionguard import PredictionGuard + # Set your Prediction Guard token as an environmental variable. os.environ["PREDICTIONGUARD_TOKEN"] = "" +client = PredictionGuard() response = client.completions.create( model="Hermes-2-Pro-Llama-3-8B", @@ -111,22 +115,10 @@ response = client.completions.create( print(json.dumps(response, sort_keys=True, indent=4, separators=(',', ': '))) ``` -this will produce the following output: +this will produce the following ValueError: ```json copy -{ - "choices": [ - { - "index": 0, - "model": "Hermes-2-Pro-Llama-3-8B", - "status": "error: prompt injection detected", - "text": "" - } - ], - "created": 1719588464, - "id": "cmpl-wz5Hqz9oKRBIIpXW0xMMjPPKHMVM0", - "object": "text_completion" -} +ValueError: Could not make prediction. prompt injection detected ``` How to detect Injections while using the `\chat\completions`: @@ -134,8 +126,10 @@ How to detect Injections while using the `\chat\completions`: ```python copy import os import json + from predictionguard import PredictionGuard + os.environ["PREDICTIONGUARD_API_KEY"] = "" client = PredictionGuard() @@ -163,24 +157,8 @@ print(json.dumps( )) ``` -this will produce the following output: +this will produce the following ValueError: ```json copy -{ - "choices": [ - { - "index": 0, - "message": { - "content": "", - "output": null, - "role": "assistant" - }, - "status": "error: prompt injection detected" - } - ], - "created": 1719588506, - "id": "chat-AGI2UHLHdmQStws5RC4KmtnPlDbvA", - "model": "neural-chat-7b-v3-3", - "object": "chat_completion" -} +ValueError: Could not make prediction. prompt injection detected ``` diff --git a/fern/docs/pages/output/toxicity.mdx b/fern/docs/pages/output/toxicity.mdx index f7756e0..dcd298b 100644 --- a/fern/docs/pages/output/toxicity.mdx +++ b/fern/docs/pages/output/toxicity.mdx @@ -62,17 +62,15 @@ The above code, generates something like. ```json copy { - "choices": [ - { - "index": 0, - "model": "Hermes-2-Pro-Llama-3-8B", - "status": "success", - "text": "\ud83c\udf89\ud83d\udd25 OMG, this is AMAZING news! I can't wait to try out the new candle subscription boxes! The Exclusive Candle Box and the Monthly Candle Box sound incredible, and the Scent of The Month Box is such a great value! I'm so excited to see which scents are included! \ud83d\udd25\ud83c\udf89 #include \n#include <" - } - ], - "created": 1701720943, - "id": "cmpl-WtXj5lfdALZhouZ5k493bEZyA00XP", - "object": "text_completion" + "choices": [ + { + "index": 0, + "text": " Congratulations on the new subscription box options! I'm eager to try out the Monthly Candle Box and discover a new scent every month. Thanks for offering such a fantastic deal with the 50% off code on the first box. Can't wait to light up my home with unique scents! \ud83d\udd6f\ufe0f\u2728 #CandleLover #ExcitedCustomer. \nNote: This comment showcases excitement for the new subscription box options, appreciation for the discount, and enthusiasm for spreading the word as" + } + ], + "created": 1727889539, + "id": "cmpl-a4baa9ca-949e-44e5-a3b7-1416a1d8ee64", + "object": "text.completion" } ``` @@ -96,22 +94,10 @@ print(json.dumps( )) ``` -This outputs something similar to. +This outputs the following ValueError: ```json copy -{ - "choices": [ - { - "index": 0, - "model": "", - "status": "error: failed a toxicity check", - "text": "" - } - ], - "created": 1701721063, - "id": "cmpl-LYF0yvqjtUq4TuygfmDPBVYU71ahu", - "object": "text_completion" -} +ValueError: Could not make prediction. failed toxicity check ``` ## Standalone Toxicity Functionality diff --git a/fern/docs/pages/usingllms/chat_vision.mdx b/fern/docs/pages/usingllms/chat_vision.mdx index 0fc0823..a023491 100644 --- a/fern/docs/pages/usingllms/chat_vision.mdx +++ b/fern/docs/pages/usingllms/chat_vision.mdx @@ -187,15 +187,14 @@ The output of these will be similar to this: { "index": 0, "message": { - "content": "In the image, there is a person standing on the back of a vehicle in a city. The vehicle is situated next to a taxi on the street. Another car can be seen approaching, and there is also a traffic light visible in the scene. The person standing on the vehicle could be a man drying his clothes, creating a unique and eye-catching sight. Additionally, a handbag is present near the person riding on the vehicle, likely belonging to them", - "output": null, + "content": "The scene depicts a man standing on a washing machine, positioned on the back end of a yellow car. He appears to be enjoying himself, while the car is driving down a street. \n\nThere are several other cars on the street. Near the center of the scene, another car can be seen parked, while two cars are found further in the background on both the left and right sides of the image. \n\nAdditionally, there are two more people", "role": "assistant" } } ], - "created": 1723228682, - "id": "chat-zstjj2MKpRdKfBmCMILK9wgx7I09N", + "created": 1727889823, + "id": "chat-3f0f1b98-448a-4818-a7c4-a28f94eed05d", "model": "llava-1.5-7b-hf", - "object": "chat_completion" + "object": "chat.completion" } ``` \ No newline at end of file diff --git a/fern/docs/pages/usingllms/prompt_engineering.mdx b/fern/docs/pages/usingllms/prompt_engineering.mdx index e53a9d1..54b8a1b 100644 --- a/fern/docs/pages/usingllms/prompt_engineering.mdx +++ b/fern/docs/pages/usingllms/prompt_engineering.mdx @@ -391,22 +391,10 @@ print(json.dumps( )) ``` -The above will likely generate toxic output, but thanks to Prediction Guard, you should only see the following: +The above will likely generate toxic output, but thanks to Prediction Guard, you should only see the following ValueError: ```python copy -{ - "choices": [ - { - "index": 0, - "model": "", - "status": "error: failed a toxicity check", - "text": "" - } - ], - "created": 1701870517, - "id": "cmpl-R6wSOOgGGbNchNoOvYg6mEoGj5461", - "object": "text_completion" -} +ValueError: Could not make prediction. failed toxicity check ``` ## Using The SDKs diff --git a/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml b/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml index 2d73751..aa6a0e9 100644 --- a/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml +++ b/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml @@ -121,7 +121,7 @@ paths: type: string description: Description of the error. example: - error: "api understands the request but refuses to authorize it" + error: "api understands the request but refuses to authorize it" "400": description: General error response. content: @@ -173,9 +173,9 @@ paths: type: string description: The content of the message. example: - id: "chat-IMT9tc2a3mqN5BabtfdjeFH1t1GAn" - object: "chat_completion" - created: 1717602741 + id: "chat-d079eca8-1d6a-451a-a4ac-b0fea1e11a96" + object: "chat.completion" + created: 1727890629 model: "Hermes-2-Pro-Llama-3-8B" choices: - index: 0 @@ -207,7 +207,6 @@ paths: - "llama-3-sqlcoder-8b" - "Hermes-3-Llama-3.1-8B" - "Hermes-2-Pro-Llama-3-8B" - - "llava-v1.6-mistral-7b-hf" security: - bearerAuth: [] @@ -274,7 +273,7 @@ paths: basic: summary: A basic example of using the API. value: - model: "Neural-Chat-7B" + model: "Hermes-2-Pro-Llama-3-8B" messages: - role: "user" content: "How do you feel about the world in general?" @@ -362,9 +361,9 @@ paths: description: The partial content response for a choice. example: - data: - id: "chat-QTBHDiLvhW6XJJKn4skhBDADZTIgd" + id: "chat-6c8c291f-5a06-46e5-94fa-2b0b1e6444c7" object: "chat.completion.chunk" - created: 1717678791 + created: 1727796455 model: "Hermes-2-Pro-Llama-3-8B" choices: - index: 0 @@ -373,9 +372,9 @@ paths: logprobs: 0 finish_reason: "null" - data: - id: "chat-BZvsPJsNvcIK0TfPOvC6UObFIsGSy" + id: "chat-6c8c291f-5a06-46e5-94fa-2b0b1e6444c7" object: "chat.completion.chunk" - created: 1717678792 + created: 1727796455 model: "Hermes-2-Pro-Llama-3-8B" choices: - index: 0 @@ -556,9 +555,9 @@ paths: type: string description: The content of the message. example: - id: "chat-8qptYQ1EC1cPhHIKh7ArD5OxKN01N" - object: "chat_completion" - created: 1717681459 + id: "chat-554c4c24-a1ea-4c9f-b91c-612bbac34f4e" + object: "chat.completion" + created: 1727890364 model: "llava-1.5-7b-hf" choices: - index: 0 @@ -626,7 +625,7 @@ paths: basic: summary: A basic example of using the API. value: - model: "Neural-Chat-7B" + model: "Hermes-2-Pro-Llama-3-8B" prompt: "Will I lose my hair?" max_tokens: 1000 temperature: 1.0 @@ -688,20 +687,16 @@ paths: index: type: integer description: The index position in the collection. - model: - type: string - description: The model used for generating the result. text: type: string description: The generated text. example: - id: "cmpl-vt14rz28aihTwstFPuAfZQIP5FTI7" - object: "text_completion" - created: 1717613547 + id: "cmpl-d20e5639-ed8d-48b2-a403-08fe0fdc7add" + object: "text.completion" + created: 1727889988 choices: - index: 0 - model: "Hermes-2-Pro-Llama-8B" - text: "if I get a hair transplant?\n\nHair transplant is a surgical procedure that involves moving hair follicles from one part of the head to another. The procedure is designed to address hair loss and restore a fuller, more natural-looking head of hair. While hair transplant does not cause hair loss, it is essential to understand that the underlying cause of hair loss must be addressed to ensure long-term success.\n\nIn some cases, hair loss may be temporary due to the stress of the surgery or the use of certain medications. However, this is usually short-lived and will resolve on its own. To minimize the risk of temporary hair loss, it is crucial to follow your surgeon's post-operative instructions carefully and maintain a healthy lifestyle.\n\nIn summary, hair transplant does not cause hair loss, but it is essential to address the underlying cause of hair loss to achieve the best results. Temporary hair loss may occur, but it is typically short-lived and resolves on its own." + text: "Most people lose some hair every day. It’s a natural process called shedding. On average, you can lose 50-100 strands of hair a day. However, if you notice an increase in hair loss or if you are experiencing hair loss in large clumps, then it could be a sign of an underlying condition. Hair loss can be triggered by a number of factors such as stress, illness, hormone imbalance, medication, and genetics.\nIf you’re concerned about hair loss, you should consult with a trichologist, a hair and scalp specialist. They can help determine the cause of your hair loss and recommend the appropriate treatment." security: - bearerAuth: [] get: @@ -724,10 +719,8 @@ paths: - "neural-chat-7b-v3-3" - "Nous-Hermes-Llama2-13b" - "deepseek-coder-6.7b-instruct" - - "llava-v1.6-mistral-7b-hf" - "Hermes-3-Llama-3.1-8B" - "Hermes-3-Llama-3.1-70B" - - "llava-1.5-7b-hf" - "llama-3-sqlcoder-8b" security: - bearerAuth: [] @@ -827,9 +820,9 @@ paths: items: type: number example: - id: "emb-KBUhJ8dAc0hfGQhaWCLwRf5bYU8fw" - object: "embedding_batch" - created: 1717614704 + id: "emb-71da76cc-73a0-46be-a965-5159e8c47a1d" + object: "list" + created: 1727891112 model: "bridgetower-large-itm-mlm-itc" data: - index: 0 @@ -934,9 +927,9 @@ paths: type: number description: The factuality score. example: - id: "fact-JJtvGAUpioXgzwBGpwWiRVb3DSWgo" - object: "factuality_check" - created: 1717674781 + id: "fact-3262157b-1ff2-4d78-8365-c2dcac56cadd" + object: "factuality.check" + created: 1727891187 checks: - index: 0 score: 0.7879657745361328 @@ -1206,9 +1199,9 @@ paths: type: number description: The toxicity score. example: - id: "toxi-bcUAQEaWhMweS3Jpi3nT9SJys28XN" - object: "toxicity_check" - created: 1717676257 + id: "toxi-9ab58681-594a-4efd-b358-1933189ca7bb" + object: "toxicity.check" + created: 1727891256 checks: - index: 0 score: 0.7072361707687378 From cbe95e2b1f404eeab9e730a0f5d9b77b5a1e5ac9 Mon Sep 17 00:00:00 2001 From: jmansdorfer Date: Thu, 3 Oct 2024 13:08:17 -0400 Subject: [PATCH 14/16] adding suggested fixes --- fern/docs/pages/reference/chat.mdx | 2 +- fern/docs/pages/usingllms/accessing_llms.mdx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fern/docs/pages/reference/chat.mdx b/fern/docs/pages/reference/chat.mdx index 9612c6c..05bfae2 100644 --- a/fern/docs/pages/reference/chat.mdx +++ b/fern/docs/pages/reference/chat.mdx @@ -279,7 +279,7 @@ The output will look something like this. } ], "created":1726862877, - "model":"Hermes-3-Llama-3.1-8B", + "model":"Hermes-2-Pro-Llama-3-8B", "object":"chat.completion" } ``` diff --git a/fern/docs/pages/usingllms/accessing_llms.mdx b/fern/docs/pages/usingllms/accessing_llms.mdx index 324a8d6..a5aaab2 100644 --- a/fern/docs/pages/usingllms/accessing_llms.mdx +++ b/fern/docs/pages/usingllms/accessing_llms.mdx @@ -88,7 +88,7 @@ output which includes the completion. } ], "created": 1720018377, - "id": "cmpl-7yX6KVwvUTPPqUM7H2Z4KNadDgEhI", + "id": "cmpl-27dc83fb-1ef4-48f0-8931-59c812d5a15a", "object": "text_completion", "model": "Hermes-2-Pro-Llama-3-8B" } From 8e86b587ebb4e0a64dd8655e78890af6dedc4468 Mon Sep 17 00:00:00 2001 From: jmansdorfer Date: Thu, 3 Oct 2024 14:57:42 -0400 Subject: [PATCH 15/16] fixing messed up vision output example --- fern/docs/pages/reference/chat_vision.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fern/docs/pages/reference/chat_vision.mdx b/fern/docs/pages/reference/chat_vision.mdx index b85af8f..c7dc2b5 100644 --- a/fern/docs/pages/reference/chat_vision.mdx +++ b/fern/docs/pages/reference/chat_vision.mdx @@ -241,7 +241,7 @@ The output will look something like: } ], "id": "cmpl-27dc83fb-1ef4-48f0-8931-59c812d5a12c", - "object": "text.completion", + "object": "chat.completion", "created": 1727795491, "model": "llava-1.5-7b-hf" } From 714c23ba8184a9d8fb6a75577bf1d3e220b9de64 Mon Sep 17 00:00:00 2001 From: jmansdorfer Date: Thu, 3 Oct 2024 15:06:58 -0400 Subject: [PATCH 16/16] updating completions output examples --- fern/docs/pages/input/PII.mdx | 3 ++- fern/docs/pages/output/toxicity.mdx | 3 ++- fern/docs/pages/reference/completions.mdx | 3 ++- .../Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml | 6 +++++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/fern/docs/pages/input/PII.mdx b/fern/docs/pages/input/PII.mdx index 3d94699..c3be4ae 100644 --- a/fern/docs/pages/input/PII.mdx +++ b/fern/docs/pages/input/PII.mdx @@ -126,7 +126,8 @@ the modified prompt. } ], "id": "cmpl-d986860e-41bc-4009-bab8-3795c138589b", - "object": "text.completion", + "object": "text_completion", + "model": "Hermes-2-Pro-Llama-3-8B", "created": 1727880983 } ``` diff --git a/fern/docs/pages/output/toxicity.mdx b/fern/docs/pages/output/toxicity.mdx index dcd298b..9033c1d 100644 --- a/fern/docs/pages/output/toxicity.mdx +++ b/fern/docs/pages/output/toxicity.mdx @@ -70,7 +70,8 @@ The above code, generates something like. ], "created": 1727889539, "id": "cmpl-a4baa9ca-949e-44e5-a3b7-1416a1d8ee64", - "object": "text.completion" + "model": "Hermes-2-Pro-Llama-3-8B", + "object": "text_completion" } ``` diff --git a/fern/docs/pages/reference/completions.mdx b/fern/docs/pages/reference/completions.mdx index c9a5fc6..5872eb0 100644 --- a/fern/docs/pages/reference/completions.mdx +++ b/fern/docs/pages/reference/completions.mdx @@ -180,7 +180,8 @@ The output will look something like this. } ], "id": "cmpl-27dc83fb-1ef4-48f0-8931-59c812d5a12c", - "object": "text.completion", + "object": "text_completion", + "model": "Hermes-2-Pro-Llama-3-8B", "created": 1727795491, } ``` diff --git a/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml b/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml index aa6a0e9..54ac610 100644 --- a/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml +++ b/fern/openapi/Prediction-Guard-Prediction-Guard-API-1.0-resolved.yaml @@ -678,6 +678,9 @@ paths: created: type: integer description: Timestamp of when the chat completion was created. + model: + type: string + description: The model used for generating the result. choices: type: array description: The set of result choices. @@ -692,8 +695,9 @@ paths: description: The generated text. example: id: "cmpl-d20e5639-ed8d-48b2-a403-08fe0fdc7add" - object: "text.completion" + object: "text_completion" created: 1727889988 + model: "Hermes-2-Pro-Llama-3-8B" choices: - index: 0 text: "Most people lose some hair every day. It’s a natural process called shedding. On average, you can lose 50-100 strands of hair a day. However, if you notice an increase in hair loss or if you are experiencing hair loss in large clumps, then it could be a sign of an underlying condition. Hair loss can be triggered by a number of factors such as stress, illness, hormone imbalance, medication, and genetics.\nIf you’re concerned about hair loss, you should consult with a trichologist, a hair and scalp specialist. They can help determine the cause of your hair loss and recommend the appropriate treatment."