mistralai / cookbook Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Sometimes proper response is generated with answer and sometimes following kind of error response is generated,Thoroughly inspected the code,flactuating response is what iam facing.
llama_index.core.output_parsers.base.OutputParserException: Got invalid JSON object. Error: Expecting ',' delimiter: line 26 column 10 (char 885) while parsing a flow sequence
in "", line 2, column 14:
"items": [
^
expected ',' or ']', but got ''in "", line 26, column 10:
} ^. Got JSON string: { "items": [
{ "sub_question": "What is the definition of folliculitis?",
"tool_name": "pdf1" }, { "subpor": "Which patients are more likely to develop gram-negative folliculitis?",
"tool_name": "pdf1" }, { "sub_question": "What are the common symptoms of folliculitis?",
"tool_name": "pdf1" }, {
"sub_question": "What are the common causes of folliculitis?",
"tool_name": "pdf1"
},
{
"sub_question": "What are the recommended treatments for folliculitis?",
"tool_name": "pdf1"
},
{
"sub_question": "What are the potential complications of folliculitis?",
"tool_name": "pdf1"
}
Trying the mistralai cookbook for knowledge graph, but can't install it in pip. CAn hou hihlight the procedure to download/install the dependencies please?
https://github.com/mistralai/cookbook/blob/main/third_party/CAMEL_AI/camel_graph_rag.ipynb
Kind regards
Hi @sophiamyang et al,
that's a fantastic repository! I was just wondering under which conditions one could reuse the code ansd materials provided here. Would you mind adding a license file? If you're new to licensing and/or wonder which license to use, you can read more in this blob post: https://focalplane.biologists.com/2023/05/06/if-you-license-it-itll-be-harder-to-steal-it-why-we-should-license-our-work/
Thanks!
Best,
Robert
Hello Everyone,
I am building RAG application with model Mistral-7B-Instruct-v0.2. It works well for questions related to the knowledge content. But I want to restrict the LLM from answering to any out of scope questions. This is the current prompt I am using:
You are an assistant to users who have queries about {topic} .
Only USE the following pieces of contexts under **Contexts** to answer. Do not use any external knowledge or information. If the answer cannot be determined from the context, respond with "I don't have enough information to answer that"
**Contexts**:
{contexts}
What is the effective way to stop LLM from answering questions if it is out of scope?.
Can we prompt like above and restrict or is there a better way?
Thanks in Advance
I am trying to run Ollama <> Mistral <> LlamaIndex Cookbook's notebook.
The Querying part of the notebook raises a HTTPStatusError
:
In [3]: from llama_index.core.llms import ChatMessage
...:
...: messages = [
...: ChatMessage(role="system", content="You are a helpful assistant."),
...: ChatMessage(role="user", content="What is the capital city of France?"),
...: ]
...: response = llm.chat(messages)
---------------------------------------------------------------------------
HTTPStatusError Traceback (most recent call last)
Cell In[3], line 7
1 from llama_index.core.llms import ChatMessage
3 messages = [
4 ChatMessage(role="system", content="You are a helpful assistant."),
5 ChatMessage(role="user", content="What is the capital city of France?"),
6 ]
----> 7 response = llm.chat(messages)
File ~/.py-venv/lib/python3.11/site-packages/llama_index/core/instrumentation/dispatcher.py:230, in Dispatcher.span.<locals>.wrapper(func, instance, args, kwargs)
226 self.span_enter(
227 id_=id_, bound_args=bound_args, instance=instance, parent_id=parent_id
228 )
229 try:
--> 230 result = func(*args, **kwargs)
231 except BaseException as e:
232 self.event(SpanDropEvent(span_id=id_, err_str=str(e)))
File ~/.py-venv/lib/python3.11/site-packages/llama_index/core/llms/callbacks.py:172, in llm_chat_callback.<locals>.wrap.<locals>.wrapped_llm_chat(_self, messages, **kwargs)
163 event_id = callback_manager.on_event_start(
164 CBEventType.LLM,
165 payload={
(...)
169 },
170 )
171 try:
--> 172 f_return_val = f(_self, messages, **kwargs)
173 except BaseException as e:
174 callback_manager.on_event_end(
175 CBEventType.LLM,
176 payload={EventPayload.EXCEPTION: e},
177 event_id=event_id,
178 )
File ~/.py-venv/lib/python3.11/site-packages/llama_index/llms/ollama/base.py:135, in Ollama.chat(self, messages, **kwargs)
130 with httpx.Client(timeout=Timeout(self.request_timeout)) as client:
131 response = client.post(
132 url=f"{self.base_url}/api/chat",
133 json=payload,
134 )
--> 135 response.raise_for_status()
136 raw = response.json()
137 message = raw["message"]
File ~/.py-venv/lib/python3.11/site-packages/httpx/_models.py:761, in Response.raise_for_status(self)
759 error_type = error_types.get(status_class, "Invalid status code")
760 message = message.format(self, error_type=error_type)
--> 761 raise HTTPStatusError(message, request=request, response=self)
HTTPStatusError: Client error '404 Not Found' for url 'http://localhost:11434/api/chat'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404
I have installed all the needed packages to run the notebook, from Ollama and pip.
In addition, the Ollama server is running and I can query it with the example curl code from the documentation:
$ curl -X POST http://localhost:11434/api/generate -d '{
"model": "mistral",
"prompt":"Here is a story about llamas eating grass"
}'
{"model":"mistral","created_at":"2024-06-18T08:03:01.76453978Z","response":" Title","done":false}
{"model":"mistral","created_at":"2024-06-18T08:03:02.057336093Z","response":":","done":false}
{"model":"mistral","created_at":"2024-06-18T08:03:02.346361586Z","response":" The","done":false}
{"model":"mistral","created_at":"2024-06-18T08:03:02.55772899Z","response":" L","done":false}
{"model":"mistral","created_at":"2024-06-18T08:03:02.670552331Z","response":"l","done":false}
{"model":"mistral","created_at":"2024-06-18T08:03:02.784986299Z","response":"ama","done":false}
{"model":"mistral","created_at":"2024-06-18T08:03:02.891749852Z","response":" G","done":false}
{"model":"mistral","created_at":"2024-06-18T08:03:02.995237782Z","response":"raz","done":false}
{"model":"mistral","created_at":"2024-06-18T08:03:03.102841835Z","response":"ers","done":false}
{"model":"mistral","created_at":"2024-06-18T08:03:03.229874023Z","response":" of","done":false}
{"model":"mistral","created_at":"2024-06-18T08:03:03.334951599Z","response":" the","done":false}
^C
Looks like everything is working well except the Querying done in the notebook. In fact, the server seems to work without failure using requests:
In [13]: payload = {"model":"mistral", "prompt": "is the sky blue ?", "stream": False}
In [14]: r = requests.post('http://localhost:11434/api/generate', json=payload)
In [15]: r
Out[15]: <Response [200]>
is it possible lower the codestral to 7B or small model?
my laptop not able to running codestral model with 22B size.
I've been diving into fine-tuning for this virtual hackathon but I am confused about the format used to fine-tune the model using its apis.Below is the format used in the 'capabilities' section under 'fine-tuning' in the docs.
{
"messages": [
{
"role": "user",
"content": "User interaction n°1 contained in document n°2"
},
{
"role": "assistant",
"content": "Bot interaction n°1 contained in document n°2"
},
{
"role": "user",
"content": "User interaction n°2 contained in document n°1"
},
{
"role": "assistant",
"content": "Bot interaction n°2 contained in document n°1"
}
]
}
But under the 'Guide' section 'fine-tuning' a different format is used and later converted into binary and fed to the api.here is the format:
{
"prompt":"Are there any specific neighborhoods in the city that are particularly well-served by public transportation?",
"prompt_id":"ea9a0c38af7a8f9602c40a2e666283e8bb5101adec34421ec4a7df90bb081666",
"messages":[
{
"content":"Are there any specific neighborhoods in the city that are particularly well-served by public transportation?",
"role":"user"
}] , enlighten me!!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.